[hackers] [quark] Handle more signals, replace signal() with sigaction() || Quentin Rameau

From: <git_AT_suckless.org>
Date: Mon, 24 Jul 2017 16:49:37 +0200 (CEST)

commit 1c5f45c090f0204611862d68e4511b46c39b9618
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Mon Jul 24 00:51:26 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Mon Jul 24 16:49:24 2017 +0200

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

diff --git a/quark.c b/quark.c
index 5ca7d34..4821033 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -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
Received on Mon Jul 24 2017 - 16:49:37 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 24 2017 - 17:03:31 CEST