summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-11-08 22:33:23 +0100
committerLouis Burda <quent.burda@gmail.com>2023-11-08 22:33:23 +0100
commitb412a627c2936b4cf8651316e5c27f5579441eff (patch)
tree74cc2b2a422a1e8a771160368181713a7000584a
parent0fc8c7b1e72475723406a0a8086897d3d05ffdbd (diff)
downloadpipeln-b412a627c2936b4cf8651316e5c27f5579441eff.tar.gz
pipeln-b412a627c2936b4cf8651316e5c27f5579441eff.zip
Fix waitall() condition
-rw-r--r--pipeln.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/pipeln.c b/pipeln.c
index f70f695..7c30841 100644
--- a/pipeln.c
+++ b/pipeln.c
@@ -112,7 +112,6 @@ waitall(pid_t tpid)
int status, exitcode;
pid_t pid;
- errno = 0;
exitcode = 0;
do {
pid = waitpid(-1, &status, 0);
@@ -124,7 +123,7 @@ waitall(pid_t tpid)
else if (!exitcode && WIFSIGNALED(status))
exitcode = 128 + WTERMSIG(status);
}
- } while (pid >= 0 && errno != ECHILD);
+ } while (pid >= 0 || errno != ECHILD);
exit(exitcode);
}