From eb8eec916f1fba65ef286617b90c07fba0a47b76 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Sat, 27 Feb 2021 20:07:48 +0100 Subject: [PATCH] check return value of sighandler --- hkd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hkd.c b/hkd.c index 15f36cf..b77ff9d 100644 --- a/hkd.c +++ b/hkd.c @@ -175,9 +175,13 @@ int main (int argc, char *argv[]) dead = 0; memset(&action, 0, sizeof(action)); action.sa_handler = int_handler; - sigaction(SIGINT, &action, NULL); - sigaction(SIGUSR1, &action, NULL); - sigaction(SIGCHLD, &action, NULL); + + if (sigaction(SIGINT, &action, NULL) == -1) + die(wrap_err("Error setting interrupt handler:")); + if (sigaction(SIGUSR1, &action, NULL) == -1) + die(wrap_err("Error setting interrupt handler:")); + if (sigaction(SIGCHLD, &action, NULL) == -1) + die(wrap_err("Error setting interrupt handler:")); /* Parse config file */ parse_config_file();