rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone
Blob Blame History Raw
diff -pruN bash-4.1/jobs.c bash-4.1.patched/jobs.c
--- bash-4.1/jobs.c	2009-11-30 03:42:05.000000000 +0530
+++ bash-4.1.patched/jobs.c	2012-03-06 16:44:15.706595703 +0530
@@ -3037,6 +3037,7 @@ waitchld (wpid, block)
   PROCESS *child;
   pid_t pid;
   int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
+  int called_from_sighand = sigchld;
   static int wcontinued = WCONTINUED;	/* run-time fix for glibc problem */
 
   call_set_current = children_exited = 0;
@@ -3161,7 +3162,17 @@ waitchld (wpid, block)
 	  longjmp (wait_intr_buf, 1);
 	}
 
-      run_sigchld_trap (children_exited);
+      /* Queue up the trap handler if we're called directly from within the
+         signal handler. */
+      if (called_from_sighand)
+	{
+	  int i = children_exited;
+	  interrupt_immediately = 0;
+	  while (i--)
+	    trap_handler (SIGCHLD);
+	}
+      else
+	run_sigchld_trap (children_exited);
     }
 
   /* We have successfully recorded the useful information about this process