diff --git a/include/signal.h b/include/signal.h index fa00c94119..7318a334d3 100644 --- a/include/signal.h +++ b/include/signal.h @@ -39,7 +39,6 @@ #define MIN_SIGNO 1 /* Lowest valid signal number */ #define MAX_SIGNO 63 /* Highest valid signal number */ -#define GOOD_SIGNO(s) ((((unsigned)(s)) <= MAX_SIGNO)) /* Definitions for "standard" signals */ @@ -236,7 +235,10 @@ # define SIG_HOLD ((_sa_handler_t)1) /* Used only with sigset() */ #endif -#define tkill(tid, signo) tgkill((pid_t)-1, tid, signo) +#define GOOD_SIGNO(s) (((unsigned)(s)) <= MAX_SIGNO) +#define UNCAUGHT_SIGNO(s) ((s) == SIGKILL || (s) == SIGSTOP) + +#define tkill(tid, signo) tgkill((pid_t)-1, tid, signo) /**************************************************************************** * Public Types diff --git a/libs/libc/signal/sig_set.c b/libs/libc/signal/sig_set.c index 24b0fc34ee..3b78f6bc1f 100644 --- a/libs/libc/signal/sig_set.c +++ b/libs/libc/signal/sig_set.c @@ -101,7 +101,7 @@ _sa_handler_t sigset(int signo, _sa_handler_t func) sigset_t set; int ret = -EINVAL; - if (signo == SIGKILL || signo == SIGSTOP || !GOOD_SIGNO(signo)) + if (!GOOD_SIGNO(signo) || UNCAUGHT_SIGNO(signo)) { goto err; } diff --git a/libs/libc/signal/sig_signal.c b/libs/libc/signal/sig_signal.c index 5dbcf9faae..d16191042b 100644 --- a/libs/libc/signal/sig_signal.c +++ b/libs/libc/signal/sig_signal.c @@ -62,7 +62,7 @@ _sa_handler_t signal(int signo, _sa_handler_t func) struct sigaction oact; int ret = -EINVAL; - if (!GOOD_SIGNO(signo)) + if (!GOOD_SIGNO(signo) || UNCAUGHT_SIGNO(signo)) { goto err; }