diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-04-01 04:11:02 +0900 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-04-01 15:20:03 +0200 |
commit | 76e62a4d2279a038b1e6feb95ecbfbbf9a57892d (patch) | |
tree | d6585711fe3cad53ce45dae934a7a888d3a7fd4f /src/udev/udevd.c | |
parent | 245d386a031a73eabe1e09c6b9000e836fea98e0 (diff) | |
download | systemd-76e62a4d2279a038b1e6feb95ecbfbbf9a57892d.tar.gz systemd-76e62a4d2279a038b1e6feb95ecbfbbf9a57892d.tar.bz2 systemd-76e62a4d2279a038b1e6feb95ecbfbbf9a57892d.zip |
udev: move udev_ctrl_cleanup() into manager_free()
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r-- | src/udev/udevd.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index eab2b46250..140ec35293 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -296,6 +296,9 @@ static void manager_free(Manager *manager) { udev_builtin_exit(); + if (manager->pid == getpid_cached()) + udev_ctrl_cleanup(manager->ctrl); + manager_clear_for_worker(manager); sd_netlink_unref(manager->rtnl); @@ -590,9 +593,6 @@ static int event_queue_insert(Manager *manager, sd_device *dev) { assert(dev); /* only one process can add events to the queue */ - if (manager->pid == 0) - manager->pid = getpid_cached(); - assert(manager->pid == getpid_cached()); /* We only accepts devices received by device monitor. */ @@ -1596,6 +1596,8 @@ static int manager_new(Manager **ret, int fd_ctrl, int fd_uevent, const char *cg static int main_loop(Manager *manager) { int fd_worker, r; + manager->pid = getpid_cached(); + /* unnamed socket from workers to the main daemon */ r = socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, manager->worker_watch); if (r < 0) @@ -1813,10 +1815,7 @@ static int run(int argc, char *argv[]) { log_debug_errno(r, "Failed to adjust OOM score, ignoring: %m"); } - r = main_loop(manager); - /* FIXME: move this into manager_free() */ - udev_ctrl_cleanup(manager->ctrl); - return r; + return main_loop(manager); } DEFINE_MAIN_FUNCTION(run); |