From fb297756b66dac62afd2e6531a83ac3f5b49e052 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Wed, 27 Jan 2021 12:16:34 +0100 Subject: [PATCH] Changed signal() to sigaction() --- signal.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/signal.c b/signal.c index e642399..8b594cb 100644 --- a/signal.c +++ b/signal.c @@ -16,8 +16,18 @@ int stopped() void set_intr() { - signal(SIGINT, stopall); + struct sigaction sig; + + sig.sa_handler = stopall; + sigemptyset(&sig.sa_mask); + //sigaddset(&new.sa_mask, SIGINT); + //sigaddset(&new.sa_mask, SIGALRM); + sig.sa_flags = 0; + //sigaction(SIGINT, NULL, &old); + //if (old_action.sa_handler != SIG_IGN) { + sigaction(SIGINT, &sig, NULL); + sigaction(SIGALRM, &sig, NULL); # ifdef DEBUG - printf("SIGINT armed.\n"); + printf("SIGINT and SIGALRM armed.\n"); # endif }