diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-08-03 17:09:27 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-08-03 17:09:27 +0000 |
commit | 4bdd64534ff87261e204570697d7f7e83af5b6cd (patch) | |
tree | 905e049463a281a57c294f90f5c4df715b2a5800 | |
parent | d03db7f0c7c59bf5ef95114b5787324a5171587a (diff) | |
download | glibc-4bdd64534ff87261e204570697d7f7e83af5b6cd.tar glibc-4bdd64534ff87261e204570697d7f7e83af5b6cd.tar.gz glibc-4bdd64534ff87261e204570697d7f7e83af5b6cd.tar.bz2 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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | sysdeps/posix/sigset.c | 23 |
2 files changed, 23 insertions, 6 deletions
@@ -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; } |