From 738ffcd69a7950105dec6f80250842db56d266f7 Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Wed, 10 Aug 2011 00:30:38 +1000 Subject: [PATCH] Block SIGINT, SIGTERM and SIGQUIT when in the signal handler --- src/intf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/intf.c b/src/intf.c index 461587c..45ad32a 100644 --- a/src/intf.c +++ b/src/intf.c @@ -154,9 +154,12 @@ void init_screen (void) // Initialise signal handlers - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; sa.sa_handler = sigterm_handler; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sigaddset(&sa.sa_mask, SIGINT); + sigaddset(&sa.sa_mask, SIGTERM); + sigaddset(&sa.sa_mask, SIGQUIT); if (sigaction(SIGINT, &sa, NULL) == -1) { errno_exit("sigaction(SIGINT)"); @@ -330,9 +333,9 @@ void sigterm_handler (int sig) endwin(); // Reraise the same signal, using the system-default handler - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; sa.sa_handler = SIG_DFL; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); sigaction(sig, &sa, NULL); raise(sig);