mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 22:50:29 +00:00
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.
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user