diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-05 19:45:37 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-05 19:47:20 +0100 |
commit | 9a11da9d33fa4497eeca978cc99dc9b8381d8e37 (patch) | |
tree | f3165a7e56b92e44794fe2c8fdcb378df8aee66f /src/signals.c | |
parent | Nicer X macros (diff) | |
download | redshift-ng-9a11da9d33fa4497eeca978cc99dc9b8381d8e37.tar.gz redshift-ng-9a11da9d33fa4497eeca978cc99dc9b8381d8e37.tar.bz2 redshift-ng-9a11da9d33fa4497eeca978cc99dc9b8381d8e37.tar.xz |
cleanup + cast + use pipe2 on linux
Signed-off-by: Mattias Andrée <m@maandree.se>
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; } |