diff options
Diffstat (limited to 'libc/signal/sigpause.c')
-rw-r--r-- | libc/signal/sigpause.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index dd05e6e0a..e25803a9b 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -21,12 +21,13 @@ #include <signal.h> #include <stddef.h> /* For NULL. */ +#include "sigset-cvt-mask.h" + /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ int __sigpause (int sig_or_mask, int is_sig) { sigset_t set; - int sig; if (is_sig != 0) { @@ -36,20 +37,8 @@ int __sigpause (int sig_or_mask, int is_sig) || sigdelset (&set, sig_or_mask) < 0) return -1; } - else - { - if (sigemptyset (&set) < 0) - return -1; - - if (sizeof (sig_or_mask) == sizeof (set)) - *(int *) &set = sig_or_mask; - else if (sizeof (unsigned long int) == sizeof (set)) - *(unsigned long int *) &set = (unsigned int) sig_or_mask; - else - for (sig = 1; sig < NSIG; ++sig) - if ((sig_or_mask & sigmask (sig)) && __sigaddset (&set, sig) < 0) - return -1; - } + else if (sigset_set_old_mask (&set, sig_or_mask) < 0) + return -1; return sigsuspend (&set); } |