churchyard / rpms / bash

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