From aa67df90d5fa9c072793e4088f08212716ad2cee Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 26 Apr 2019 22:46:40 +0300 Subject: [PATCH] Fix mistaken comparison logic --- src/cypherpunks.ru/nncp/cmd/nncp-check/main.go | 4 +++- src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-check/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-check/main.go index e983760..a99bd2f 100644 --- a/src/cypherpunks.ru/nncp/cmd/nncp-check/main.go +++ b/src/cypherpunks.ru/nncp/cmd/nncp-check/main.go @@ -75,7 +75,9 @@ func main() { if nodeOnly != nil && nodeId != *nodeOnly.Id { continue } - isBad = isBad || ctx.Check(node.Id) + if !ctx.Check(node.Id) { + isBad = true + } } if isBad { os.Exit(1) diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go index ea139ce..fe068b5 100644 --- a/src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go +++ b/src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go @@ -320,10 +320,10 @@ func main() { } if flag.NArg() > 0 { - if !process(ctx, flag.Arg(0), *keep, *dryRun, *stdout, *dumpMeta) { - os.Exit(1) + if process(ctx, flag.Arg(0), *keep, *dryRun, *stdout, *dumpMeta) { + return } - return + os.Exit(1) } hasErrors := false @@ -337,7 +337,9 @@ func main() { if _, seen := seenMetaPaths[metaPath]; seen { continue } - hasErrors = hasErrors || !process(ctx, metaPath, *keep, *dryRun, false, false) + if !process(ctx, metaPath, *keep, *dryRun, false, false) { + hasErrors = true + } seenMetaPaths[metaPath] = struct{}{} } } @@ -346,7 +348,9 @@ func main() { log.Fatalln("Specified -node does not allow incoming") } for _, metaPath := range findMetas(ctx, *nodeOnly.Incoming) { - hasErrors = hasErrors || !process(ctx, metaPath, *keep, *dryRun, false, false) + if !process(ctx, metaPath, *keep, *dryRun, false, false) { + hasErrors = true + } } } if hasErrors { -- 2.44.0