From: Sergey Matveev Date: Fri, 26 Apr 2019 19:46:40 +0000 (+0300) Subject: Fix mistaken comparison logic X-Git-Tag: 4.0^2~14 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=aa67df90d5fa9c072793e4088f08212716ad2cee;p=nncp.git Fix mistaken comparison logic --- 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 {