about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/posix/sigset.c23
2 files changed, 23 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index d113918493..95602f12f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1999-08-03  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/posix/sigset.c: Unblock the signal after setting its
+	disposition.  Use SIG_BLOCK/SIG_UNBLOCK instead of SIG_SETMASK to
+	avoid two calls to sigprocmask.
+
 1999-08-02  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/generic/s_nexttowardf.c: Fix typo.
diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c
index 52da0f3060..e234d8a52d 100644
--- a/sysdeps/posix/sigset.c
+++ b/sysdeps/posix/sigset.c
@@ -29,23 +29,22 @@ sigset (sig, disp)
      __sighandler_t disp;
 {
   struct sigaction act, oact;
+  sigset_t set;
 
 #ifdef SIG_HOLD
   /* Handle SIG_HOLD first.  */
   if (disp == SIG_HOLD)
     {
-      sigset_t set;
-
-      /* Retrieve current signal set.  */
-      if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+      /* Create an empty signal set.  */
+      if (__sigemptyset (&set) < 0)
 	return SIG_ERR;
 
       /* Add the specified signal.  */
       if (sigaddset (&set, sig) < 0)
 	return SIG_ERR;
 
-      /* Set the new mask.  */
-      if (__sigprocmask (SIG_SETMASK, &set, NULL) < 0)
+      /* Add the signal set to the current signal mask.  */
+      if (__sigprocmask (SIG_BLOCK, &set, NULL) < 0)
 	return SIG_ERR;
 
       return SIG_HOLD;
@@ -66,5 +65,17 @@ sigset (sig, disp)
   if (__sigaction (sig, &act, &oact) < 0)
     return SIG_ERR;
 
+  /* Create an empty signal set.  */
+  if (__sigemptyset (&set) < 0)
+    return SIG_ERR;
+
+  /* Add the specified signal.  */
+  if (sigaddset (&set, sig) < 0)
+    return SIG_ERR;
+
+  /* Remove the signal set from the current signal mask.  */
+  if (__sigprocmask (SIG_UNBLOCK, &set, NULL) < 0)
+    return SIG_ERR;
+
   return oact.sa_handler;
 }