summary refs log tree commit diff
path: root/sysdeps/posix/sigset.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-03 17:09:27 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-03 17:09:27 +0000
commit4bdd64534ff87261e204570697d7f7e83af5b6cd (patch)
tree905e049463a281a57c294f90f5c4df715b2a5800 /sysdeps/posix/sigset.c
parentd03db7f0c7c59bf5ef95114b5787324a5171587a (diff)
downloadglibc-4bdd64534ff87261e204570697d7f7e83af5b6cd.tar.gz
glibc-4bdd64534ff87261e204570697d7f7e83af5b6cd.tar.xz
glibc-4bdd64534ff87261e204570697d7f7e83af5b6cd.zip
Update.
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.
Diffstat (limited to 'sysdeps/posix/sigset.c')
-rw-r--r--sysdeps/posix/sigset.c23
1 files changed, 17 insertions, 6 deletions
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;
 }