]> err.no Git - systemd/commitdiff
fix sorting of rules files
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 16 Oct 2008 19:12:08 +0000 (21:12 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 16 Oct 2008 19:12:08 +0000 (21:12 +0200)
udev/lib/libudev-list.c
udev/lib/libudev-private.h
udev/udev-rules-parse.c

index 918277cb649b584863abeb5b7d1c671391756a81..fb8301b0bd933953776c787b7e5f383e7e9f4851 100644 (file)
@@ -148,7 +148,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_
                list_entry_insert_before(entry_new, entry_loop);
        else
                list_entry_append(entry_new, list);
-       info(udev, "'%s=%s' added\n", entry_new->name, entry_new->value);
+       dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value);
        return entry_new;
 }
 
@@ -182,6 +182,13 @@ void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct ude
        list_entry->list = list;
 }
 
+void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry)
+{
+       list_node_remove(&list_entry->node);
+       list_node_insert_between(&list_entry->node, entry->node.prev, &entry->node);
+       list_entry->list = entry->list;
+}
+
 struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list)
 {
        if (list_is_empty(list))
index 6549669711058225c39121a98d251ecd162b9e41..96e62a8ec5263c2dcccf002a968dfa62a35d0c2e 100644 (file)
@@ -131,6 +131,7 @@ extern void udev_list_entry_remove(struct udev_list_entry *entry);
 extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list);
 extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry);
 extern void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct udev_list_node *list);
+extern void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry);
 extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry);
 extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag);
 #define udev_list_entry_foreach_safe(entry, tmp, first) \
index 737bbf4d9207874dd3745742f497a87ace96dd6b..41dc85aba868008f040974bc1bc56095ed13686b 100644 (file)
@@ -854,20 +854,18 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam
 
                                if (file_base == NULL)
                                        continue;
-
                                if (strcmp(file_base, sort_base) == 0) {
                                        info(udev, "rule file basename '%s' already added, ignoring '%s'\n",
                                             file_name, sort_name);
                                        udev_list_entry_remove(sort_loop);
                                        sort_loop = NULL;
-                                       continue;
+                                       break;
                                }
-
                                if (strcmp(file_base, sort_base) > 0)
                                        break;
                        }
                        if (sort_loop != NULL)
-                               udev_list_entry_move_to_list(sort_loop, &file_list);
+                               udev_list_entry_move_before(sort_loop, file_loop);
                }
        }
 
@@ -878,7 +876,7 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam
                if (stat(file_name, &statbuf) == 0 && statbuf.st_size > 0)
                        parse_file(rules, file_name);
                else
-                       err(udev, "could not read '%s': %m\n", file_name);
+                       info(udev, "can not read '%s'\n", file_name);
                udev_list_entry_remove(file_loop);
        }
        return retval;