diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2022-09-05 06:59:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2022-09-05 06:59:43 +0000 |
commit | 61b4199fe43e94d6753290a62eb45363503e0deb (patch) | |
tree | d21b093b2e9aa4530e68b845d8368a43e9895034 /src/libstddjb | |
parent | 61e06f3b12afe464c3b4fcd23d4a3a07251c50ac (diff) | |
download | skalibs-61b4199fe43e94d6753290a62eb45363503e0deb.tar.xz |
Better NSIG detection and fix
Incredibly enough, OpenBSD defines NSIG correctly, so our workaround
was not accurate.
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/selfpipe_trapset.c | 1 | ||||
-rw-r--r-- | src/libstddjb/sig_catch.c | 10 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/libstddjb/selfpipe_trapset.c b/src/libstddjb/selfpipe_trapset.c index 9559c07..3bb64d4 100644 --- a/src/libstddjb/selfpipe_trapset.c +++ b/src/libstddjb/selfpipe_trapset.c @@ -30,7 +30,6 @@ int selfpipe_trapset (sigset_t const *set) #else #include <skalibs/nonposix.h> -#include <skalibs/bsdsnowflake.h> #include <errno.h> #include <signal.h> 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 <skalibs/nonposix.h> -#include <skalibs/bsdsnowflake.h> #include <signal.h> #include <errno.h> @@ -13,8 +12,8 @@ #include <skalibs/nsig.h> /* - 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) ; } |