From: Joey Hess Date: Tue, 23 Feb 2010 20:35:34 +0000 (-0500) Subject: parallel: Fix logic error in code handling -l that could make parallel return a bogus... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1a2b5fe9f8e474c55308637caa3f4852f52b480;p=moreutils parallel: Fix logic error in code handling -l that could make parallel return a bogus 255 exit code when all jobs succeeded. Closes: #569617 --- diff --git a/debian/changelog b/debian/changelog index fe89fdf..b0ac071 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sun, 21 Feb 2010 13:16:10 -0500 diff --git a/parallel.c b/parallel.c index 19f341a..6bd4665 100644 --- a/parallel.c +++ b/parallel.c @@ -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) {