X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev%2Fudevd.c;h=1871474ff9ea7700ac57acb4f0316d1623db6967;hb=fc1de713f5b754fb38876b5b797e18f812727f0a;hp=ef82f72d05f165962128d48cd7a78b083ecb85f5;hpb=a31d76b18675a0bf213fdd16242b4268c9ff48e0;p=elogind.git diff --git a/udev/udevd.c b/udev/udevd.c index ef82f72d0..1871474ff 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1228,16 +1228,20 @@ int main(int argc, char *argv[]) if (write(STDERR_FILENO, 0, 0) < 0) dup2(fd, STDERR_FILENO); - udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + /* udevadm control socket */ + if (sd_listen_fds(true) == 1 && sd_is_socket(SD_LISTEN_FDS_START, AF_LOCAL, SOCK_DGRAM, -1)) + udev_ctrl = udev_ctrl_new_from_fd(udev, SD_LISTEN_FDS_START); + else + udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (udev_ctrl == NULL) { - fprintf(stderr, "error initializing control socket"); - err(udev, "error initializing udevd socket"); + fprintf(stderr, "error initializing udev control socket"); + err(udev, "error initializing udev control socket"); rc = 1; goto exit; } if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { - fprintf(stderr, "error binding control socket, seems udevd is already running\n"); - err(udev, "error binding control socket, seems udevd is already running\n"); + fprintf(stderr, "error binding udev control socket\n"); + err(udev, "error binding udev control socket\n"); rc = 1; goto exit; }