udevd: do not call udev_ctrl_enable_receiving() if the socket is passed from pid1

Before c4b69e990f, if the socket fd is
passed from pid1, `udev_ctrl_enable_receiving()` was not called.
Let's preserve the original logic.
This commit is contained in:
Yu Watanabe 2018-11-26 11:57:48 +09:00
parent 986ab0d2dc
commit 6acf1ccba5
1 changed files with 5 additions and 3 deletions

View File

@ -1617,9 +1617,11 @@ static int manager_new(Manager **ret, int fd_ctrl, int fd_uevent, const char *cg
if (!manager->ctrl)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to initialize udev control socket");
r = udev_ctrl_enable_receiving(manager->ctrl);
if (r < 0)
return log_error_errno(r, "Failed to bind udev control socket: %m");
if (fd_ctrl < 0) {
r = udev_ctrl_enable_receiving(manager->ctrl);
if (r < 0)
return log_error_errno(r, "Failed to bind udev control socket: %m");
}
fd_ctrl = udev_ctrl_get_fd(manager->ctrl);
if (fd_ctrl < 0)