summary refs log tree commit diff
path: root/bin/dash/src/jobs.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-20 13:45:29 -0400
committerJune McEnroe <june@causal.agency>2021-06-20 13:46:46 -0400
commitc3c7e65db6a09cfa49fdbdce11b93fca854b6b6a (patch)
tree2a40227f0239ac87537b6231bf07a3c91a1d7d87 /bin/dash/src/jobs.c
parentsctd more aggressively (diff)
parentSquashed 'bin/dash/' changes from a45870f7..efc7765b (diff)
downloadsrc-c3c7e65db6a09cfa49fdbdce11b93fca854b6b6a.tar.gz
src-c3c7e65db6a09cfa49fdbdce11b93fca854b6b6a.zip
Merge dash v0.5.11.4
Diffstat (limited to 'bin/dash/src/jobs.c')
-rw-r--r--bin/dash/src/jobs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/dash/src/jobs.c b/bin/dash/src/jobs.c
index 5104a5e5..8fb9d4b2 100644
--- a/bin/dash/src/jobs.c
+++ b/bin/dash/src/jobs.c
@@ -81,6 +81,7 @@
 #define DOWAIT_NONBLOCK 0
 #define DOWAIT_BLOCK 1
 #define DOWAIT_WAITCMD 2
+#define DOWAIT_WAITCMD_ALL 4
 
 /* array of jobs */
 static struct job *jobtab;
@@ -615,7 +616,7 @@ waitcmd(int argc, char **argv)
 				jp->waited = 1;
 				jp = jp->prev_job;
 			}
-			if (!dowait(DOWAIT_WAITCMD, 0))
+			if (!dowait(DOWAIT_WAITCMD_ALL, 0))
 				goto sigout;
 		}
 	}
@@ -1139,6 +1140,7 @@ static int dowait(int block, struct job *jp)
 		pid = waitone(block, jp);
 		rpid &= !!pid;
 
+		block &= ~DOWAIT_WAITCMD_ALL;
 		if (!pid || (jp && jp->state != JOBRUNNING))
 			block = DOWAIT_NONBLOCK;
 	} while (pid >= 0);