svashisht / rpms / bash

Forked from rpms/bash 4 years ago
Clone

Blame SOURCES/bash-4.2-signal.patch

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