chiark / gitweb /
udev: remove remaining selinux labeling for file in /run
[elogind.git] / src / libudev / libudev-device.c
index 9ef4610a6af99e2bd77fb42ddbd4207931b7b239..a8277d1363dc4b039d20dd6a01bd4c1edee5f337 100644 (file)
@@ -1022,14 +1022,15 @@ _public_ struct udev_device *udev_device_ref(struct udev_device *udev_device)
  * Drop a reference of a udev device. If the refcount reaches zero,
  * the resources of the device will be released.
  *
+ * Returns: the passed udev device if it has still an active reference, or #NULL otherwise.
  **/
-_public_ void udev_device_unref(struct udev_device *udev_device)
+_public_ struct udev_device *udev_device_unref(struct udev_device *udev_device)
 {
         if (udev_device == NULL)
-                return;
+                return NULL;
         udev_device->refcount--;
         if (udev_device->refcount > 0)
-                return;
+                return udev_device;
         if (udev_device->parent_device != NULL)
                 udev_device_unref(udev_device->parent_device);
         free(udev_device->syspath);
@@ -1049,6 +1050,7 @@ _public_ void udev_device_unref(struct udev_device *udev_device)
         free(udev_device->envp);
         free(udev_device->monitor_buf);
         free(udev_device);
+        return NULL;
 }
 
 /**