diff options
author | jilles <jilles@FreeBSD.org> | 2013-08-24 09:57:32 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-08-24 09:57:32 +0000 |
commit | 739c3b84b86418bdb2db51451452bd5b0c568538 (patch) | |
tree | 0d53dd521b7e1dde5c57b87bf7c87d504883989c /bin | |
parent | e8031ce26c0c12d1c7b4c0eb69a6887d48355ccf (diff) | |
download | FreeBSD-src-739c3b84b86418bdb2db51451452bd5b0c568538.zip FreeBSD-src-739c3b84b86418bdb2db51451452bd5b0c568538.tar.gz |
sh: Do not prematurely discard stopped jobs in a wait builtin.
If a job is specified to 'wait', wait for it to complete. Formerly, in
interactive mode, the job was deleted if it stopped.
If no jobs are specified in interactive mode, 'wait' still waits for all jobs
to complete or stop.
In non-interactive mode, WUNTRACED is not passed to wait3() so stopped jobs
are not detected.
PR: bin/181435
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/jobs.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index 4ff5093..b6ea4da 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -495,14 +495,10 @@ waitcmdloop(struct job *job) in_waitcmd++; do { if (job != NULL) { - if (job->state) { + if (job->state == JOBDONE) { status = job->ps[job->nprocs - 1].status; if (WIFEXITED(status)) retval = WEXITSTATUS(status); -#if JOBS - else if (WIFSTOPPED(status)) - retval = WSTOPSIG(status) + 128; -#endif else retval = WTERMSIG(status) + 128; if (! iflag || ! job->changed) |