[git commit] ash: fix !ASH_BASH_COMPAT build

Denys Vlasenko vda.linux at googlemail.com
Tue Oct 6 22:13:59 UTC 2026


commit: https://git.busybox.net/busybox/commit/?id=730f515626efa59246b46a1e4581b494090ea8d5
branch: https://git.busybox.net/busybox/log/?h=master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index cffc3bf62..e1c37f808 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4390,7 +4390,11 @@ static int waitone(int block, int *status, struct job *job)
 	struct job *jp;
 	struct job *thisjob = NULL;
 #if BASH_WAIT_N
-	bool want_jobexitstatus = (block & DOWAIT_JOBSTATUS);
+	int want_jobexitstatus;
+	int local_status;
+	if (!status)
+		status = &local_status;
+	want_jobexitstatus = (block & DOWAIT_JOBSTATUS);
 	block = (block & ~DOWAIT_JOBSTATUS);
 #else
 	int nstatus;
@@ -4508,18 +4512,12 @@ static int dowait(int block, int *status, struct job *jp)
 {
 	smallint gotchld = *(volatile smallint *)&gotsigchld;
 	int pid;
-	int local_status;
 
 	if (jp && jp->state != JOBRUNNING)
 		block = DOWAIT_NONBLOCK;
 	if (block == DOWAIT_NONBLOCK && !gotchld)
 		return 1;
 
-#if BASH_WAIT_N
-	if (!status)
-		status = &local_status;
-#endif
-
 	/* In what cases we loop here:
 	 * = If we waited in blocking mode and got pid > 0,
 	 * but the job we waiting for is still running
@@ -4538,10 +4536,12 @@ static int dowait(int block, int *status, struct job *jp)
 	 */
 	do {
 		pid = waitone(block, status, jp);
+#if BASH_WAIT_N
 		if (block & DOWAIT_JOBSTATUS)
 			break;
 			/* on signals, unknown pids, or not-fully completed jobs we get -1 */
 			/* it is always DOWAIT_CHILD_OR_SIG in this case */
+#endif
 		if (pid == 0)
 			break; /* return 0: got a signal */
 		if (jp && jp->state != JOBRUNNING) {


More information about the busybox-cvs mailing list