1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-07-21 16:14:14 -04:00

Block SIGINT, SIGTERM and SIGQUIT when in the signal handler

This commit is contained in:
John Zaitseff 2011-08-10 00:30:38 +10:00
parent 040e1a5ad6
commit 738ffcd69a

View File

@ -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);