chiark / gitweb /
util: add macro for iterating through all prefixes of a path
[elogind.git] / src / libudev / libudev-enumerate.c
index b96e5b278fa0f13b84450042b15e7ad949c39035..8146f27e4f5c0c1acd4bf21b1a81a6ab3dd113fe 100644 (file)
@@ -300,7 +300,7 @@ _public_ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enume
                         /* skip to be delayed devices, and move the to
                          * the point where the prefix changes. We can
                          * only move one item at a time. */
-                        if (!move_later) {
+                        if (move_later == -1) {
                                 move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath);
 
                                 if (move_later_prefix > 0) {
@@ -721,10 +721,14 @@ static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *s
 {
         struct udev_list_entry *list_entry;
 
+        if (!subsystem)
+                return false;
+
         udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) {
                 if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0)
                         return false;
         }
+
         if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) {
                 udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) {
                         if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0)
@@ -732,6 +736,7 @@ static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *s
                 }
                 return false;
         }
+
         return true;
 }