aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-05-06 07:40:22 -0500
committerRob Landley <rob@landley.net>2021-05-06 07:40:22 -0500
commitda9786fc64a4e0c54c3eeba2699f8926943a54f0 (patch)
tree35ae862336938d13efb12e0330c5556d48e70dcd
parent9abc0ef9336000c71324fed919fa730ff5e8b022 (diff)
downloadtoybox-da9786fc64a4e0c54c3eeba2699f8926943a54f0.tar.gz
Fix nohang wait.
-rw-r--r--toys/pending/sh.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index 6e75ce60..ab2408a0 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -2978,8 +2978,8 @@ struct sh_process *wait_job(int pid, int nohang)
if (TT.jobs.c<1) return 0;
for (;;) {
errno = 0;
- if (-1 == (pid = waitpid(pid, &status, nohang ? WNOHANG : 0))) {
- if (errno==EINTR && !toys.signal) continue;
+ if (1>(pid = waitpid(pid, &status, nohang ? WNOHANG : 0))) {
+ if (!nohang && errno==EINTR && !toys.signal) continue;
return 0;
}
for (ii = 0; ii<TT.jobs.c; ii++) {