From 4ff6090dfb9c947e894a7c1d0474b8d8d8f9031a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 6 Mar 2025 09:55:27 +0100 Subject: Style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/signals.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'src/signals.c') 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=, .sa_mask={}, .sa_flags=0} NULL:"); return -1; } - if (sigaction(SIGTERM, &sigact, NULL)) { - perror("sigaction"); + weprintf("sigaction SIGTERM &{.sa_handler=, .sa_mask={}, .sa_flags=0} NULL:"); return -1; } - if (sigaction(SIGQUIT, &sigact, NULL)) { - perror("sigaction"); + weprintf("sigaction SIGQUIT &{.sa_handler=, .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=, .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 -- cgit v1.2.3-70-g09d2