diff options
author | Lukasz Florczak <lukasz.florczak@linux.intel.com> | 2022-02-21 13:05:20 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2022-04-04 17:13:02 +0200 |
commit | 83a379cfbd283b387919fe05d44eb4c49e155ad6 (patch) | |
tree | 5b3a11e1c892bacde284a4170579fd77dcb1adb4 /probe_roms.c | |
parent | udev: adapt rules to systemd v247 (diff) | |
download | mdadm-83a379cfbd283b387919fe05d44eb4c49e155ad6.tar.xz mdadm-83a379cfbd283b387919fe05d44eb4c49e155ad6.zip |
Replace error prone signal() with sigaction()
Up to this date signal() was used which implementation could vary [1].
Sigaction() call is preferred. This commit introduces replacement
from signal() to sigaction() by the use of signal_s() wrapper.
Also remove redundant signal.h header includes.
[1] https://man7.org/linux/man-pages/man2/signal.2.html
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'probe_roms.c')
-rw-r--r-- | probe_roms.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/probe_roms.c b/probe_roms.c index 7ea04c7a..94c80c2c 100644 --- a/probe_roms.c +++ b/probe_roms.c @@ -22,7 +22,6 @@ #include "probe_roms.h" #include "mdadm.h" #include <unistd.h> -#include <signal.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/stat.h> @@ -69,7 +68,8 @@ static int probe_address16(const __u16 *ptr, __u16 *val) void probe_roms_exit(void) { - signal(SIGBUS, SIG_DFL); + signal_s(SIGBUS, SIG_DFL); + if (rom_fd >= 0) { close(rom_fd); rom_fd = -1; @@ -98,7 +98,7 @@ int probe_roms_init(unsigned long align) if (roms_init()) return -1; - if (signal(SIGBUS, sigbus) == SIG_ERR) + if (signal_s(SIGBUS, sigbus) == SIG_ERR) rc = -1; if (rc == 0) { fd = open("/dev/mem", O_RDONLY); |