From 8f26017bb9cb3f38424f50511263cf70e476d98b Mon Sep 17 00:00:00 2001 From: tjg Date: Thu, 15 Aug 2002 13:45:03 +0000 Subject: Portability: don't call sigaction() for SIGKILL or SIGCONT; don't hand a garbage signal mask to sigaction() (thanks Jeremy Fitzhardinge). Also, remove use of SA_INTERRUPT (SUSv3, BSD, etc. have SA_RESTART with the inverted meaning). --- signal.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'signal.c') diff --git a/signal.c b/signal.c index de06633..dfdc8d0 100644 --- a/signal.c +++ b/signal.c @@ -8,17 +8,18 @@ #include "sigmsgs.h" #include "jbwrap.h" -#if HAVE_SA_INTERRUPT +#if HAVE_SIGACTION static void (*sys_signal(int signum, void (*handler)(int)))(int) { struct sigaction new, old; new.sa_handler = handler; - new.sa_flags = SA_INTERRUPT; + new.sa_flags = 0; /* clear SA_RESTART */ + sigfillset(&new.sa_mask); sigaction(signum, &new, &old); return old.sa_handler; } #else -#define sys_signal signal +#define sys_signal(sig, func) (signal((sig), (func))) #endif void (*sighandlers[NUMOFSIGNALS])(int); @@ -40,7 +41,7 @@ extern void catcher(int s) { #if HAVE_RESTARTABLE_SYSCALLS if (slow) { siglongjmp(slowbuf.j, s); -} + } #endif } @@ -96,6 +97,12 @@ extern void initsignal() { #endif for (i = 1; i < NUMOFSIGNALS; i++) { +#ifdef SIGKILL + if (i == SIGKILL) continue; +#endif +#ifdef SIGCONT + if (i == SIGCONT) continue; +#endif h = sys_signal(i, SIG_IGN); if (h != SIG_IGN && h != SIG_ERR) sys_signal(i, h); -- cgit v1.2.3