diff options
author | Christian Hesse <mail@eworm.de> | 2024-06-18 22:23:56 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-06-18 22:23:56 +0200 |
commit | 1e9e9360280a1871243a0d8bce0a02d2dab96030 (patch) | |
tree | 1a1e12b7f8ccddc66052a2059b1f0a08d9043921 /udev-block-notify.c | |
parent | 13c8cce40474fc80920d3649da3bbbe78c379f74 (diff) | |
download | udev-block-notify-1e9e9360280a1871243a0d8bce0a02d2dab96030.tar.gz udev-block-notify-1e9e9360280a1871243a0d8bce0a02d2dab96030.tar.zst |
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.c | 6 |
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..."); |