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
This commit is contained in:
Jilles Tjoelker 2013-08-24 09:57:32 +00:00
parent 40f27d7cf6
commit 7cb5a0d863

View File

@ -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)