diff options
Diffstat (limited to 'src/signals.c')
-rw-r--r-- | src/signals.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/signals.c b/src/signals.c index a502be9..492c90d 100644 --- a/src/signals.c +++ b/src/signals.c @@ -57,46 +57,37 @@ signals_install_handlers(void) struct sigaction sigact; sigset_t sigset; - /* Install signal handler for INT and TERM signals */ memset(&sigact, 0, sizeof(sigact)); sigemptyset(&sigset); - sigact.sa_handler = sigexit; sigact.sa_mask = sigset; sigact.sa_flags = 0; + /* Install signal handler for INT, TERM, QUIT signals */ + sigact.sa_handler = sigexit; if (sigaction(SIGINT, &sigact, NULL)) { - perror("sigaction"); + weprintf("sigaction SIGINT &{.sa_handler=<function pointer>, .sa_mask={}, .sa_flags=0} NULL:"); return -1; } - if (sigaction(SIGTERM, &sigact, NULL)) { - perror("sigaction"); + weprintf("sigaction SIGTERM &{.sa_handler=<function pointer>, .sa_mask={}, .sa_flags=0} NULL:"); return -1; } - if (sigaction(SIGQUIT, &sigact, NULL)) { - perror("sigaction"); + weprintf("sigaction SIGQUIT &{.sa_handler=<function pointer>, .sa_mask={}, .sa_flags=0} NULL:"); return -1; } /* Install signal handler for USR1 signal */ sigact.sa_handler = sigdisable; - sigact.sa_mask = sigset; - sigact.sa_flags = 0; - if (sigaction(SIGUSR1, &sigact, NULL)) { - perror("sigaction"); + weprintf("sigaction SIGUSR1 &{.sa_handler=<function pointer>, .sa_mask={}, .sa_flags=0} NULL:"); return -1; } - /* Ignore CHLD signal. This causes child processes - (hooks) to be reaped automatically. */ + /* Ignore CHLD signal. This causes child processes (hooks) to be reaped automatically. */ sigact.sa_handler = SIG_IGN; - sigact.sa_mask = sigset; - sigact.sa_flags = 0; - if (sigaction(SIGCHLD, &sigact, NULL)) { - perror("sigaction"); + weprintf("sigaction SIGCHLD &{.sa_handler=SIG_IGN, .sa_mask={}, .sa_flags=0} NULL:"); return -1; } #endif |