chiark / gitweb /
libudev: enumerate - include parent device itself with match_parent()
[elogind.git] / libudev / libudev-device.c
index 8289acf3a97149a548de0bdd1179a92a18bec34b..025527bb8ab59f2114e34d812c5d8d48d5755b20 100644 (file)
@@ -1641,20 +1641,23 @@ UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_
 {
        if (udev_device == NULL)
                return NULL;
+       if (!udev_device->info_loaded)
+               udev_device_read_db(udev_device, NULL);
        return udev_list_get_entry(&udev_device->tags_list);
 }
 
-int udev_device_has_tag(struct udev_device *udev_device, const char *tag)
+UDEV_EXPORT int udev_device_has_tag(struct udev_device *udev_device, const char *tag)
 {
        struct udev_list_entry *list_entry;
 
+       if (udev_device == NULL)
+               return false;
        if (!udev_device->info_loaded)
                udev_device_read_db(udev_device, NULL);
        list_entry = udev_device_get_tags_list_entry(udev_device);
-       list_entry =  udev_list_entry_get_by_name(list_entry, tag);
-       if (list_entry != NULL)
-               return 1;
-       return 0;
+       if (udev_list_entry_get_by_name(list_entry, tag) != NULL)
+               return true;
+       return false;
 }
 
 #define ENVP_SIZE                      128