nalika / rpms / bash

Forked from rpms/bash 2 years ago
Clone
Blob Blame History Raw
diff -up bash-4.1/sig.h.signal bash-4.1/sig.h
--- bash-4.1/sig.h.signal	2009-01-04 20:32:41.000000000 +0100
+++ bash-4.1/sig.h	2012-08-28 11:19:14.920224571 +0200
@@ -96,6 +96,8 @@ do { \
   sigprocmask (SIG_BLOCK, &nvar, &ovar); \
 } while (0)
 
+#define UNBLOCK_SIGNAL(ovar) sigprocmask (SIG_SETMASK, &ovar, (sigset_t *)NULL)
+
 #if defined (HAVE_POSIX_SIGNALS)
 #  define BLOCK_CHILD(nvar, ovar) \
 	BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
diff -up bash-4.1/trap.c.signal bash-4.1/trap.c
--- bash-4.1/trap.c.signal	2009-10-10 23:21:44.000000000 +0200
+++ bash-4.1/trap.c	2012-08-28 10:58:14.746345797 +0200
@@ -516,6 +516,8 @@ set_signal (sig, string)
      int sig;
      char *string;
 {
+  sigset_t set, oset;
+
   if (SPECIAL_TRAP (sig))
     {
       change_signal (sig, savestring (string));
@@ -546,9 +548,10 @@ set_signal (sig, string)
      environment in which it is safe to do so. */
   if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
     {
-      set_signal_handler (sig, SIG_IGN);
+      BLOCK_SIGNAL (sig, set, oset);
       change_signal (sig, savestring (string));
       set_signal_handler (sig, trap_handler);
+      UNBLOCK_SIGNAL (oset);
     }
   else
     change_signal (sig, savestring (string));