diff options
Diffstat (limited to 'src/libstddjb/sig_catch.c')
-rw-r--r-- | src/libstddjb/sig_catch.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstddjb/sig_catch.c b/src/libstddjb/sig_catch.c index d0a72df..5195d4b 100644 --- a/src/libstddjb/sig_catch.c +++ b/src/libstddjb/sig_catch.c @@ -2,10 +2,14 @@ /* MT-unsafe */ +#include <signal.h> + +#include <skalibs/functypes.h> #include <skalibs/sig.h> -int sig_catch (int sig, skasighandler_t_ref f) +int sig_catch (int sig, sig_func_ref f) { - struct skasigaction ssa = { f, SKASA_MASKALL | SKASA_NOCLDSTOP } ; - return sig_catcha(sig, &ssa) ; + struct sigaction action = { .sa_handler = f, .sa_flags = SA_RESTART | SA_NOCLDSTOP } ; + sigfillset(&action.sa_mask) ; + return sigaction(sig, &action, 0) >= 0 ; } |