aboutsummaryrefslogtreecommitdiffstats
path: root/netlink-notify.c
diff options
context:
space:
mode:
authorGravatar no92 <no92.mail@gmail.com>2024-06-18 18:12:38 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-06-18 19:07:23 +0200
commitad9058d61e3ff02fba381de6fcd7984f27cdac12 (patch)
treeb9e6228ba60d2943ec77730ef279fa515c32aa7a /netlink-notify.c
parent15915b69d683f99af24249faf05a75fbe4f4fc39 (diff)
downloadnetlink-notify-ad9058d61e3ff02fba381de6fcd7984f27cdac12.tar.gz
netlink-notify-ad9058d61e3ff02fba381de6fcd7984f27cdac12.tar.zst
use sigaction(2) instead of signal(2)
As stated in the man pages, `sigaction` should be preferred to `signal`. Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'netlink-notify.c')
-rw-r--r--netlink-notify.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/netlink-notify.c b/netlink-notify.c
index 7359e0f..29fc2fe 100644
--- a/netlink-notify.c
+++ b/netlink-notify.c
@@ -540,8 +540,11 @@ int main (int argc, char **argv) {
goto out30;
}
- signal(SIGINT, received_signal);
- signal(SIGTERM, received_signal);
+ struct sigaction act = { 0 };
+ act.sa_handler = received_signal;
+
+ sigaction(SIGINT, &act, NULL);
+ sigaction(SIGTERM, &act, NULL);
#ifdef HAVE_SYSTEMD
sd_notify(0, "READY=1\nSTATUS=Waiting for netlink events...");