quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit 1c5f45c090f0204611862d68e4511b46c39b9618
parent 947b5a6a0aaa7c6eaa4012b082173a50cb89b5de
Author: Quentin Rameau <quinq@fifth.space>
Date:   Mon, 24 Jul 2017 00:51:26 +0200

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

Diffstat:
quark.c | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/quark.c b/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