chiark / gitweb /
udevd: control - no not delete socket file when --daemon is used
authorKay Sievers <kay.sievers@vrfy.org>
Sun, 9 Oct 2011 22:38:56 +0000 (00:38 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Sun, 9 Oct 2011 22:38:56 +0000 (00:38 +0200)
udev/udev-ctrl.c
udev/udev.h
udev/udevd.c

index 43484cc..4bca807 100644 (file)
@@ -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)
index 402c738..eaba4ed 100644 (file)
@@ -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);
index fdb3e42..60edea9 100644 (file)
@@ -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);