chiark / gitweb /
use libexecdir, bindir, sbindir, switch to /usr/lib/udev in documentation
[elogind.git] / udev / udev-ctrl.c
index 43484cc8386fbea3c9a01c4c37b0d7b89b767e96..e4348c314d4b2632cf2e755072daee547aae608e 100644 (file)
@@ -156,16 +156,23 @@ 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 == NULL)
+               return 0;
+       if (uctrl->cleanup_socket)
+               unlink(uctrl->saddr.sun_path);
+       return 0;
+}
+
 int udev_ctrl_get_fd(struct udev_ctrl *uctrl)
 {
        if (uctrl == NULL)
-               return -1;
+               return -EINVAL;
        return uctrl->sock;
 }