Handle more signals, replace signal() with sigaction()
This commit is contained in:
parent
947b5a6a0a
commit
1c5f45c090
1 changed files with 10 additions and 1 deletions
11
quark.c
11
quark.c
|
@ -909,7 +909,16 @@ sigcleanup(int sig)
|
|||
static void
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue