summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-02-23 15:35:34 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-02-23 15:35:34 -0500
commita1a2b5fe9f8e474c55308637caa3f4852f52b480 (patch)
tree2030b907719861f416d2a1a53f185a226277bfb8
parentf8f42e5fae33fc0e5a5500c2594982f84de592a2 (diff)
downloadmoreutils-a1a2b5fe9f8e474c55308637caa3f4852f52b480.tar.gz
parallel: Fix logic error in code handling -l that could make parallel return a bogus 255 exit code when all jobs succeeded. Closes: #569617
-rw-r--r--debian/changelog2
-rw-r--r--parallel.c6
2 files changed, 5 insertions, 3 deletions
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 <joeyh@debian.org> 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) {