]> Cypherpunks.ru repositories - nncp.git/commitdiff
Fix mistaken comparison logic
authorSergey Matveev <stargrave@stargrave.org>
Fri, 26 Apr 2019 19:46:40 +0000 (22:46 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 26 Apr 2019 19:46:40 +0000 (22:46 +0300)
src/cypherpunks.ru/nncp/cmd/nncp-check/main.go
src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go

index e983760c94a6d63f0c585040858c75ed22534bce..a99bd2f0c20ee62c10d2029147fbe045919431c1 100644 (file)
@@ -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)
index ea139ce00eb000860c7c00cfdbc9a3329726a06f..fe068b5326871e7349cc606778e803e6d944b239 100644 (file)
@@ -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 {