From da9786fc64a4e0c54c3eeba2699f8926943a54f0 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 6 May 2021 07:40:22 -0500 Subject: Fix nohang wait. --- toys/pending/sh.c | 4 ++-- 1 file 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