]> err.no Git - moreutils/commitdiff
parallel: Fix logic error in code handling -l that could make parallel return a bogus...
authorJoey Hess <joey@gnu.kitenet.net>
Tue, 23 Feb 2010 20:35:34 +0000 (15:35 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 23 Feb 2010 20:35:34 +0000 (15:35 -0500)
debian/changelog
parallel.c

index fe89fdfaa25d77dd6e947f7fe6824bbdc6790d18..b0ac0718e4276ddcea32cb73fc3c6f8c75eef624 100644 (file)
@@ -4,6 +4,8 @@ moreutils (0.39) UNRELEASED; urgency=low
   * parallel: Fix exit code handling when commands are specified after --
   * parallel: Make -j 0 do something reasonable (start all jobs at once).
   * parallel: Fix to really avoid running new jobs when load is too high.
+  * parallel: Fix logic error in code handling -l that could make parallel
+    return a bogus 255 exit code when all jobs succeeded. Closes: #569617
 
  -- Joey Hess <joeyh@debian.org>  Sun, 21 Feb 2010 13:16:10 -0500
 
index 19f341aa92a42696d419ea0f7a4591bf16176077..6bd4665cbc33ab8bc00e74bb569ba4e5bf3a07c1 100644 (file)
@@ -211,7 +211,7 @@ int main(int argc, char **argv) {
                        argidx += argsatonce;
                        curjobs++;
                }
-
+               
                if (maxjobs == 0 || curjobs == maxjobs) {
                        returncode |= wait_for_child(0);
                        curjobs--;
@@ -222,10 +222,10 @@ int main(int argc, char **argv) {
                        sleep(1); /* XXX We should have a better
                                   * heurestic than this */
                        r = wait_for_child(WNOHANG);
-                       if (r > 0) {
+                       if (r > 0)
                                returncode |= r;
+                       if (r != -1)
                                curjobs--;
-                       }
                }
        }
        while (curjobs > 0) {