aboutsummaryrefslogtreecommitdiffstats
path: root/udev-block-notify.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-06-18 22:23:56 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-06-18 22:23:56 +0200
commit1e9e9360280a1871243a0d8bce0a02d2dab96030 (patch)
tree1a1e12b7f8ccddc66052a2059b1f0a08d9043921 /udev-block-notify.c
parent13c8cce40474fc80920d3649da3bbbe78c379f74 (diff)
downloadudev-block-notify-1e9e9360280a1871243a0d8bce0a02d2dab96030.tar.gz
udev-block-notify-1e9e9360280a1871243a0d8bce0a02d2dab96030.tar.zst
use sigaction(2) instead of signal(2)HEADmain
As stated in the man pages, `sigaction` should be preferred to `signal`.
Diffstat (limited to 'udev-block-notify.c')
-rw-r--r--udev-block-notify.c6
1 files 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...");