summaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
Diffstat (limited to 'job.c')
-rw-r--r--job.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/job.c b/job.c
index 28d1e6b..48048d1 100644
--- a/job.c
+++ b/job.c
@@ -525,6 +525,8 @@ child_handler (int sig UNUSED)
extern int shell_function_pid, shell_function_completed;
+static int reap_lock = 0;
+
/* Reap all dead children, storing the returned status and the new command
state (`cs_finished') in the `file' member of the `struct child' for the
dead child, and removing the child from the chain. In addition, if BLOCK
@@ -545,6 +547,9 @@ reap_children (int block, int err)
# define REAP_MORE dead_children
#endif
+ if (reap_lock)
+ fatal (NILF, _("INTERNAL: reap_children invoked while reap_lock set."));
+
/* As long as:
We have at least one child outstanding OR a shell function in progress,
@@ -1470,6 +1475,7 @@ start_waiting_job (struct child *c)
}
/* Start the first command; reap_children will run later command lines. */
+ reap_lock = 1;
start_job_command (c);
switch (f->command_state)
@@ -1500,6 +1506,8 @@ start_waiting_job (struct child *c)
break;
}
+ reap_lock = 0;
+
return 1;
}