rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone

Blame SOURCES/bash-4.1-trap.patch

07a490
Only in bash-4.1: _patchlevel
07a490
diff -rup bash-4.1.orig/trap.c bash-4.1/trap.c
07a490
--- bash-4.1.orig/trap.c	2013-05-14 13:58:06.224000564 +0900
07a490
+++ bash-4.1/trap.c	2013-06-26 16:59:42.968001502 +0900
07a490
@@ -269,6 +269,9 @@ run_pending_traps ()
07a490
   if (catch_flag == 0)		/* simple optimization */
07a490
     return;
07a490
 
07a490
+  if (running_trap > 0)
07a490
+    return;			/* no recursive trap invocations */
07a490
+
07a490
   catch_flag = 0;
07a490
 
07a490
   /* Preserve $? when running trap. */
07a490
@@ -294,6 +297,8 @@ run_pending_traps ()
07a490
 #  endif
07a490
 #endif /* HAVE_POSIX_SIGNALS */
07a490
 
07a490
+	  running_trap = sig + 1;
07a490
+
07a490
 	  if (sig == SIGINT)
07a490
 	    {
07a490
 	      run_interrupt_trap ();
07a490
@@ -338,7 +343,14 @@ run_pending_traps ()
07a490
 	      save_subst_varlist = subst_assign_varlist;
07a490
 	      subst_assign_varlist = 0;
07a490
 
07a490
+#if defined (JOB_CONTROL)
07a490
+	      save_pipeline (1);        /* XXX only provides one save level */
07a490
+#endif
07a490
 	      parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
07a490
+#if defined (JOB_CONTROL)
07a490
+	      restore_pipeline (1);
07a490
+#endif
07a490
+
07a490
 	      restore_token_state (token_state);
07a490
 	      free (token_state);
07a490
 
07a490
@@ -346,6 +358,7 @@ run_pending_traps ()
07a490
 	    }
07a490
 
07a490
 	  pending_traps[sig] = 0;
07a490
+	  running_trap = 0;
07a490
 
07a490
 #if defined (HAVE_POSIX_SIGNALS)
07a490
 	  sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);