Handle more signals, replace signal() with sigaction()

This commit is contained in:
Quentin Rameau 2017-07-24 00:51:26 +02:00 committed by Laslo Hunhold
parent 947b5a6a0a
commit 1c5f45c090

11
quark.c
View file

@ -909,7 +909,16 @@ sigcleanup(int sig)
static void static void
handlesignals(void(*hdl)(int)) handlesignals(void(*hdl)(int))
{ {
signal(SIGINT, hdl); struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_handler = hdl;
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGQUIT, &sa, NULL);
} }
static int static int