summaryrefslogtreecommitdiff
path: root/src/udev/udevd.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/udev/udevd.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/udev/udevd.c')
-rw-r--r--src/udev/udevd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 056cf8c8ee..830bad9541 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -42,6 +42,8 @@
#include "sd-daemon.h"
#include "sd-event.h"
+
+#include "signal-util.h"
#include "event-util.h"
#include "rtnl-util.h"
#include "cgroup-util.h"
@@ -69,7 +71,6 @@ typedef struct Manager {
struct udev_list_node events;
char *cgroup;
pid_t pid; /* the process that originally allocated the manager object */
- sigset_t sigmask_orig;
struct udev_rules *rules;
struct udev_list properties;
@@ -448,12 +449,10 @@ static void worker_spawn(Manager *manager, struct event *event) {
udev_event_execute_rules(udev_event,
arg_event_timeout_usec, arg_event_timeout_warn_usec,
&manager->properties,
- manager->rules,
- &manager->sigmask_orig);
+ manager->rules);
udev_event_execute_run(udev_event,
- arg_event_timeout_usec, arg_event_timeout_warn_usec,
- &manager->sigmask_orig);
+ arg_event_timeout_usec, arg_event_timeout_warn_usec);
if (udev_event->rtnl)
/* in case rtnl was initialized */
@@ -1513,7 +1512,6 @@ static int manager_new(Manager **ret) {
}
static int manager_listen(Manager *manager) {
- sigset_t mask;
int r, fd_worker, one = 1;
assert(manager);
@@ -1536,8 +1534,7 @@ static int manager_listen(Manager *manager) {
udev_watch_restore(manager->udev);
/* block and listen to all signals on signalfd */
- sigfillset(&mask);
- sigprocmask(SIG_SETMASK, &mask, &manager->sigmask_orig);
+ assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, SIGHUP, SIGCHLD, -1) == 0);
r = sd_event_default(&manager->event);
if (r < 0)