svashisht / rpms / bash

Forked from rpms/bash 4 years ago
Clone

Blame SOURCES/bash-4.1-trap.patch

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