diff options
author | no92 <no92.mail@gmail.com> | 2024-06-18 18:12:38 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-06-18 19:07:23 +0200 |
commit | ad9058d61e3ff02fba381de6fcd7984f27cdac12 (patch) | |
tree | b9e6228ba60d2943ec77730ef279fa515c32aa7a /netlink-notify.c | |
parent | 15915b69d683f99af24249faf05a75fbe4f4fc39 (diff) | |
download | netlink-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.c | 7 |
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..."); |