diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2010-05-27 21:37:14 +1000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-05-27 21:37:14 +1000 |
commit | 207e4c2a322fe0f928944f7004b5b17ae2dceaaa (patch) | |
tree | 51b52f1f6065ac676e74931ee7eeae222c6d9d02 /src/jobs.c | |
parent | [EXPAND] Fix corruption of redirections with byte 0x81 (diff) | |
download | dash-207e4c2a322fe0f928944f7004b5b17ae2dceaaa.tar.gz dash-207e4c2a322fe0f928944f7004b5b17ae2dceaaa.zip |
[JOBS] Fix wait regression where it does not wait for all jobs
The sigsuspend patch broke wait by making it return after just one job has completed. This is because we rely on pendingsigs to signal work and never clear it until waitcmd finishes. This patch adds a separate gotsigchld for this purpose so we can clear it before we start waiting. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | src/jobs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/jobs.c b/src/jobs.c index a4fada0..060187c 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -1124,7 +1124,6 @@ waitproc(int block, int *status) sigset_t mask, oldmask; int flags = block == DOWAIT_BLOCK ? 0 : WNOHANG; int err; - int sig; #if JOBS if (jobctl) @@ -1132,6 +1131,7 @@ waitproc(int block, int *status) #endif do { + gotsigchld = 0; err = wait3(status, flags, NULL); if (err || !block) break; @@ -1141,11 +1141,11 @@ waitproc(int block, int *status) sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, &oldmask); - while (!(sig = pendingsigs)) + while (!gotsigchld && !pendingsigs) sigsuspend(&oldmask); sigclearmask(); - } while (sig == SIGCHLD); + } while (gotsigchld); return err; } |