summaryrefslogtreecommitdiff
path: root/jobs.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2020-04-10 18:26:33 -0400
committerChet Ramey <chet.ramey@case.edu>2020-04-10 18:26:33 -0400
commitb3968b54c13def5803efc82d4c63d84446fe28bf (patch)
treedb5d03afcacdb58ca647ccc3d81042c67fd18d44 /jobs.c
parentea31c00845c858098d232bd014bf27b5a63a668b (diff)
downloadbash-b3968b54c13def5803efc82d4c63d84446fe28bf.tar.gz
commit bash-20200408 snapshot
Diffstat (limited to 'jobs.c')
-rw-r--r--jobs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/jobs.c b/jobs.c
index 6bc5f2ae..516239e3 100644
--- a/jobs.c
+++ b/jobs.c
@@ -3286,6 +3286,8 @@ wait_for_any_job (flags, ps)
BLOCK_CHILD (set, oset);
for (i = 0; i < js.j_jobslots; i++)
{
+ if ((flags & JWAIT_WAITING) && jobs[i] && IS_WAITING (i) == 0)
+ continue; /* if we don't want it, skip it */
if (jobs[i] && DEADJOB (i) && IS_NOTIFIED (i) == 0)
{
return_job:
@@ -3336,8 +3338,12 @@ return_job:
/* Now we see if we have any dead jobs and return the first one */
BLOCK_CHILD (set, oset);
for (i = 0; i < js.j_jobslots; i++)
- if (jobs[i] && DEADJOB (i))
- goto return_job;
+ {
+ if ((flags & JWAIT_WAITING) && jobs[i] && IS_WAITING (i) == 0)
+ continue; /* if we don't want it, skip it */
+ if (jobs[i] && DEADJOB (i))
+ goto return_job;
+ }
UNBLOCK_CHILD (oset);
}