summaryrefslogtreecommitdiff
path: root/src/test/test-udev.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-06-02 17:07:21 +0200
committerTom Gundersen <teg@jklm.no>2015-06-03 01:41:34 +0200
commit8314de1d815667b0289423d7e6bfbe8d83759077 (patch)
tree445eebd933125101a20288e24f4229290fa28d98 /src/test/test-udev.c
parenta39423c2ef31636a0d22a22a7eec5fd0036b807e (diff)
udevd: simplify signal mask handling
We used to block all signals, and restore the original signal mask before exec'ing external processes. Now we just block the signals we care about and unconditionally unblock all signals before exec'ing.
Diffstat (limited to 'src/test/test-udev.c')
-rw-r--r--src/test/test-udev.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index f3953fe26a..d1fe953071 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -28,6 +28,7 @@
#include "missing.h"
#include "selinux-util.h"
+#include "signal-util.h"
#include "udev.h"
#include "udev-util.h"
@@ -79,7 +80,6 @@ int main(int argc, char *argv[]) {
char syspath[UTIL_PATH_SIZE];
const char *devpath;
const char *action;
- sigset_t mask, sigmask_orig;
int err;
err = fake_filesystems();
@@ -93,8 +93,6 @@ int main(int argc, char *argv[]) {
log_debug("version %s", VERSION);
mac_selinux_init("/dev");
- sigprocmask(SIG_SETMASK, NULL, &sigmask_orig);
-
action = argv[1];
if (action == NULL) {
log_error("action missing");
@@ -118,8 +116,7 @@ int main(int argc, char *argv[]) {
event = udev_event_new(dev);
- sigfillset(&mask);
- sigprocmask(SIG_SETMASK, &mask, &sigmask_orig);
+ assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, SIGHUP, SIGCHLD, -1) == 0);
/* do what devtmpfs usually provides us */
if (udev_device_get_devnode(dev) != NULL) {
@@ -142,11 +139,9 @@ int main(int argc, char *argv[]) {
udev_event_execute_rules(event,
3 * USEC_PER_SEC, USEC_PER_SEC,
NULL,
- rules,
- &sigmask_orig);
+ rules);
udev_event_execute_run(event,
- 3 * USEC_PER_SEC, USEC_PER_SEC,
- NULL);
+ 3 * USEC_PER_SEC, USEC_PER_SEC);
out:
mac_selinux_finish();