Blame SOURCES/bash-4.1-defer-sigchld-trap.patch

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