From 1f5a5100f3bdfdaf9ef71b29931574b678ff0d82 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 10 Oct 2011 00:38:56 +0200 Subject: [PATCH] udevd: control - no not delete socket file when --daemon is used --- udev/udev-ctrl.c | 9 +++++++-- udev/udev.h | 1 + udev/udevd.c | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c index 43484cc8..4bca807b 100644 --- a/udev/udev-ctrl.c +++ b/udev/udev-ctrl.c @@ -156,12 +156,17 @@ struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) return uctrl; if (uctrl->sock >= 0) close(uctrl->sock); - if (uctrl->cleanup_socket) - unlink(uctrl->saddr.sun_path); free(uctrl); return NULL; } +int udev_ctrl_cleanup(struct udev_ctrl *uctrl) +{ + if (uctrl->cleanup_socket) + unlink(uctrl->saddr.sun_path); + return 0; +} + int udev_ctrl_get_fd(struct udev_ctrl *uctrl) { if (uctrl == NULL) diff --git a/udev/udev.h b/udev/udev.h index 402c738a..eaba4ed3 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -102,6 +102,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); +int udev_ctrl_cleanup(struct udev_ctrl *uctrl); struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); int udev_ctrl_get_fd(struct udev_ctrl *uctrl); int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); diff --git a/udev/udevd.c b/udev/udevd.c index fdb3e420..60edea98 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1420,7 +1420,7 @@ int main(int argc, char *argv[]) goto exit; default: rc = EXIT_SUCCESS; - goto exit_keep_queue; + goto exit_daemonize; } setsid(); @@ -1704,7 +1704,8 @@ int main(int argc, char *argv[]) rc = EXIT_SUCCESS; exit: udev_queue_export_cleanup(udev_queue_export); -exit_keep_queue: + udev_ctrl_cleanup(udev_ctrl); +exit_daemonize: if (fd_ep >= 0) close(fd_ep); worker_list_cleanup(udev); -- 2.39.5