diff options
Diffstat (limited to 'src/signals.c')
-rw-r--r-- | src/signals.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/signals.c b/src/signals.c index 8cdb9e7..70addf8 100644 --- a/src/signals.c +++ b/src/signals.c @@ -51,31 +51,28 @@ int exiting = 0; int signals_install_handlers(void) { -#if !defined(__WIN32__) +#ifndef WINDOWS struct sigaction sigact; sigset_t sigset; - int r; - sigemptyset(&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; - r = sigaction(SIGINT, &sigact, NULL); - if (r < 0) { + if (sigaction(SIGINT, &sigact, NULL)) { perror("sigaction"); return -1; } - r = sigaction(SIGTERM, &sigact, NULL); - if (r < 0) { + if (sigaction(SIGTERM, &sigact, NULL)) { perror("sigaction"); return -1; } - r = sigaction(SIGQUIT, &sigact, NULL); - if (r < 0) { + if (sigaction(SIGQUIT, &sigact, NULL)) { perror("sigaction"); return -1; } @@ -85,8 +82,7 @@ signals_install_handlers(void) sigact.sa_mask = sigset; sigact.sa_flags = 0; - r = sigaction(SIGUSR1, &sigact, NULL); - if (r < 0) { + if (sigaction(SIGUSR1, &sigact, NULL)) { perror("sigaction"); return -1; } @@ -97,8 +93,7 @@ signals_install_handlers(void) sigact.sa_mask = sigset; sigact.sa_flags = 0; - r = sigaction(SIGCHLD, &sigact, NULL); - if (r < 0) { + if (sigaction(SIGCHLD, &sigact, NULL)) { perror("sigaction"); return -1; } |