From ad9058d61e3ff02fba381de6fcd7984f27cdac12 Mon Sep 17 00:00:00 2001 From: no92 Date: Tue, 18 Jun 2024 18:12:38 +0200 Subject: use sigaction(2) instead of signal(2) As stated in the man pages, `sigaction` should be preferred to `signal`. Signed-off-by: Christian Hesse --- netlink-notify.c | 7 +++++-- 1 file 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..."); -- cgit v1.2.3-70-g09d2