From 1e9e9360280a1871243a0d8bce0a02d2dab96030 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 18 Jun 2024 22:23:56 +0200 Subject: use sigaction(2) instead of signal(2) As stated in the man pages, `sigaction` should be preferred to `signal`. --- udev-block-notify.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/udev-block-notify.c b/udev-block-notify.c index 207044f..f029f4f 100644 --- a/udev-block-notify.c +++ b/udev-block-notify.c @@ -162,8 +162,10 @@ int main (int argc, char ** argv) { notifications->notification = NULL; notifications->next = NULL; - 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 udev block events..."); -- cgit v1.2.3-70-g09d2