summaryrefslogtreecommitdiff
path: root/libc/signal
diff options
context:
space:
mode:
Diffstat (limited to 'libc/signal')
-rw-r--r--libc/signal/sigblock.c3
-rw-r--r--libc/signal/sigintr.c1
-rw-r--r--libc/signal/sigjmp.c2
-rw-r--r--libc/signal/signal.c1
-rw-r--r--libc/signal/sigset.c8
-rw-r--r--libc/signal/sigsetmask.c3
-rw-r--r--libc/signal/sigwait.c2
-rw-r--r--libc/signal/sysv_signal.c1
8 files changed, 11 insertions, 10 deletions
diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c
index 72b42c45e..5a16f336b 100644
--- a/libc/signal/sigblock.c
+++ b/libc/signal/sigblock.c
@@ -32,8 +32,7 @@ int sigblock (int mask)
sigset_t set, oset;
sigset_set_old_mask (&set, mask);
- if (sigprocmask (SIG_BLOCK, &set, &oset) < 0)
- return -1;
+ sigprocmask (SIG_BLOCK, &set, &oset); /* can't fail */
return sigset_get_old_mask (&oset);
}
libc_hidden_def(sigblock)
diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c
index 23f87e199..1a8d60eb2 100644
--- a/libc/signal/sigintr.c
+++ b/libc/signal/sigintr.c
@@ -34,6 +34,7 @@ int siginterrupt (int sig, int interrupt)
#ifdef SA_RESTART
struct sigaction action;
+ /* Fails if sig is bad. */
if (sigaction (sig, NULL, &action) < 0)
return -1;
diff --git a/libc/signal/sigjmp.c b/libc/signal/sigjmp.c
index d83b49a0b..646949935 100644
--- a/libc/signal/sigjmp.c
+++ b/libc/signal/sigjmp.c
@@ -31,7 +31,7 @@ int __sigjmp_save (sigjmp_buf env, int savemask) attribute_hidden;
int __sigjmp_save (sigjmp_buf env, int savemask)
{
env[0].__mask_was_saved = (savemask &&
- sigprocmask (SIG_BLOCK, (sigset_t *) NULL, &env[0].__saved_mask) == 0);
+ sigprocmask (SIG_BLOCK, NULL, &env[0].__saved_mask) == 0);
return 0;
}
diff --git a/libc/signal/signal.c b/libc/signal/signal.c
index 0ed281ab1..f3dfa33fc 100644
--- a/libc/signal/signal.c
+++ b/libc/signal/signal.c
@@ -45,6 +45,7 @@ __bsd_signal (int sig, __sighandler_t handler)
__sigemptyset (&act.sa_mask);
__sigaddset (&act.sa_mask, sig);
act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART;
+ /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
if (sigaction (sig, &act, &oact) < 0)
return SIG_ERR;
diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c
index 91f433661..03f3dc869 100644
--- a/libc/signal/sigset.c
+++ b/libc/signal/sigset.c
@@ -42,13 +42,11 @@ __sighandler_t sigset (int sig, __sighandler_t disp)
/* Handle SIG_HOLD first. */
if (disp == SIG_HOLD)
{
- /* Create an empty signal set. */
__sigemptyset (&set);
__sigaddset (&set, sig);
/* Add the signal set to the current signal mask. */
- if (sigprocmask (SIG_BLOCK, &set, NULL) < 0)
- return SIG_ERR;
+ sigprocmask (SIG_BLOCK, &set, NULL); /* can't fail */
return SIG_HOLD;
}
@@ -56,6 +54,7 @@ __sighandler_t sigset (int sig, __sighandler_t disp)
memset(&act, 0, sizeof(act));
act.sa_handler = disp;
+ /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
if (sigaction (sig, &act, &oact) < 0)
return SIG_ERR;
@@ -64,8 +63,7 @@ __sighandler_t sigset (int sig, __sighandler_t disp)
__sigaddset (&set, sig);
/* Remove the signal set from the current signal mask. */
- if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0)
- return SIG_ERR;
+ sigprocmask (SIG_UNBLOCK, &set, NULL); /* can't fail */
return oact.sa_handler;
}
diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c
index 9349deb38..f8784e288 100644
--- a/libc/signal/sigsetmask.c
+++ b/libc/signal/sigsetmask.c
@@ -33,8 +33,7 @@ sigsetmask (int mask)
sigset_t set, oset;
sigset_set_old_mask (&set, mask);
- if (sigprocmask (SIG_SETMASK, &set, &oset) < 0)
- return -1;
+ sigprocmask (SIG_SETMASK, &set, &oset); /* can't fail */
return sigset_get_old_mask (&oset);
}
libc_hidden_def(sigsetmask)
diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c
index 64a889f7b..bed7f979a 100644
--- a/libc/signal/sigwait.c
+++ b/libc/signal/sigwait.c
@@ -74,6 +74,8 @@ int __sigwait (const sigset_t *set, int *sig)
__sigdelset (&tmp_mask, this);
/* Register temporary action handler. */
+ /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
+ /* (so, will it work correctly if set has, say, SIGSTOP?) */
if (sigaction (this, &action, &saved[this]) != 0)
goto restore_handler;
}
diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c
index f573482f9..118094b27 100644
--- a/libc/signal/sysv_signal.c
+++ b/libc/signal/sysv_signal.c
@@ -49,6 +49,7 @@ __sighandler_t __sysv_signal (int sig, __sighandler_t handler)
act.sa_handler = handler;
__sigemptyset (&act.sa_mask);
act.sa_flags = (SA_ONESHOT | SA_NOMASK | SA_INTERRUPT) & ~SA_RESTART;
+ /* In Linux (as of 2.6.25), fails only if sig is SIGKILL or SIGSTOP */
if (sigaction (sig, &act, &oact) < 0)
return SIG_ERR;