summaryrefslogtreecommitdiff
path: root/libc/signal/sigblock.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/signal/sigblock.c')
-rw-r--r--libc/signal/sigblock.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c
index f47b75804..1d673f454 100644
--- a/libc/signal/sigblock.c
+++ b/libc/signal/sigblock.c
@@ -21,36 +21,35 @@
#include <signal.h>
/* Block signals in MASK, returning the old mask. */
-int sigblock (mask)
- int mask;
+int sigblock (int mask)
{
- register unsigned int sig;
- sigset_t set, oset;
-
- if (__sigemptyset (&set) < 0)
- return -1;
-
- if (sizeof (mask) == sizeof (set))
- *(int *) &set = mask;
- else if (sizeof (unsigned long int) == sizeof (set))
- *(unsigned long int *) &set = (unsigned int) mask;
- else
- for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
- if ((mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
+ register unsigned int sig;
+ sigset_t set, oset;
+
+ if (__sigemptyset (&set) < 0)
return -1;
- if (sigprocmask (SIG_BLOCK, &set, &oset) < 0)
- return -1;
+ if (sizeof (mask) == sizeof (set))
+ *(int *) &set = mask;
+ else if (sizeof (unsigned long int) == sizeof (set))
+ *(unsigned long int *) &set = (unsigned int) mask;
+ else
+ for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
+ if ((mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
+ return -1;
+
+ if (sigprocmask (SIG_BLOCK, &set, &oset) < 0)
+ return -1;
- if (sizeof (mask) == sizeof (oset))
- mask = *(int *) &oset;
- else if (sizeof (unsigned long int) == sizeof (oset))
- mask = *(unsigned long int*) &oset;
- else
- for (sig = 1, mask = 0; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
- if (__sigismember (&oset, sig))
- mask |= sigmask (sig);
+ if (sizeof (mask) == sizeof (oset))
+ mask = *(int *) &oset;
+ else if (sizeof (unsigned long int) == sizeof (oset))
+ mask = *(unsigned long int*) &oset;
+ else
+ for (sig = 1, mask = 0; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
+ if (__sigismember (&oset, sig))
+ mask |= sigmask (sig);
- return mask;
+ return mask;
}