summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-05-31 23:52:53 +0200
committerTom Gundersen <teg@jklm.no>2015-05-31 23:52:53 +0200
commit49f997f3bcf3ff6a1d794dfb8fbd3907d653dc33 (patch)
tree5fa7f024784bbdc086494ff02d7b5d2adf517fde
parentf6fd40d16adbd0f9ddbb1f24b4b8734fd8790ad0 (diff)
udevd: don't allocate sd_event object before fork
In daemon mode we would break sd-event as it cannot work accross different processes. Simply delay the allocation to after the fork.
-rw-r--r--src/udev/udevd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index c021e806a4..5717edd435 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1451,10 +1451,6 @@ static int manager_new(Manager **ret) {
manager->worker_watch[WRITE_END] = -1;
manager->worker_watch[READ_END] = -1;
- r = sd_event_default(&manager->event);
- if (r < 0)
- return log_error_errno(errno, "could not allocate event loop: %m");
-
manager->udev = udev_new();
if (!manager->udev)
return log_error_errno(errno, "could not allocate udev context: %m");
@@ -1541,6 +1537,10 @@ static int manager_listen(Manager *manager) {
sigfillset(&mask);
sigprocmask(SIG_SETMASK, &mask, &manager->sigmask_orig);
+ r = sd_event_default(&manager->event);
+ if (r < 0)
+ return log_error_errno(errno, "could not allocate event loop: %m");
+
r = sd_event_add_signal(manager->event, NULL, SIGINT, on_sigterm, manager);
if (r < 0)
return log_error_errno(r, "error creating sigint event source: %m");