From 61b4199fe43e94d6753290a62eb45363503e0deb Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 5 Sep 2022 06:59:43 +0000 Subject: Better NSIG detection and fix Incredibly enough, OpenBSD defines NSIG correctly, so our workaround was not accurate. Signed-off-by: Laurent Bercot --- src/libstddjb/sig_catch.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/libstddjb/sig_catch.c') diff --git a/src/libstddjb/sig_catch.c b/src/libstddjb/sig_catch.c index a11e317..1c106a0 100644 --- a/src/libstddjb/sig_catch.c +++ b/src/libstddjb/sig_catch.c @@ -3,7 +3,6 @@ /* MT-unsafe */ #include -#include #include #include @@ -13,8 +12,8 @@ #include /* - BSD fails sigaction() with EINVAL on non-catchable signals, whereas - every reasonable OS succeeds and simply ignores the signal handler. + We don't want to fail on non-catchable signals, + even if sigaction() does. */ int sig_catch (int sig, sig_func_ref f) @@ -22,8 +21,5 @@ int sig_catch (int sig, sig_func_ref f) struct sigaction action = { .sa_handler = f, .sa_flags = SA_RESTART | SA_NOCLDSTOP } ; sigfillset(&action.sa_mask) ; return sigaction(sig, &action, 0) >= 0 -#ifdef SKALIBS_BSD_SUCKS - || (errno == EINVAL && sig >= 1 && sig <= NSIG) -#endif - ; + || (errno == EINVAL && sig >= 1 && sig < SKALIBS_NSIG) ; } -- cgit v1.2.3