summaryrefslogtreecommitdiff
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-03-05 04:01:34 +0900
committerLennart Poettering <lennart@poettering.net>2019-03-05 09:27:29 +0100
commit39a15c8a8dad26deda140867f03e44a535b7bd8d (patch)
tree1afd5a9d50431156b5b8e4078983fd024a8c267b /src/udev/udev-rules.c
parent0dcb426328b16cb1f59b2bf3e8d6f51805442abf (diff)
downloadsystemd-39a15c8a8dad26deda140867f03e44a535b7bd8d.tar.gz
systemd-39a15c8a8dad26deda140867f03e44a535b7bd8d.tar.bz2
systemd-39a15c8a8dad26deda140867f03e44a535b7bd8d.zip
udev: run programs in the specified order
This fixes bugs introduced by 29448498c724da7ade1b5efb20d7472c1b128d2c and d838e14515c82b05a07f2bf393cce057b45b2b53. Previously, RUN and SECLABEL keys are stored in udev_list with its unique flag is false. If the flag is false, then udev_list is just a linked list and new entries are always added in the last. So, we should use OrderedHashmap instead of Hashmap. Fixes #11368.
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r--src/udev/udev-rules.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 178a41906f..0fb515e134 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2260,13 +2260,13 @@ int udev_rules_apply_to_event(
return log_oom();
if (IN_SET(cur->key.op, OP_ASSIGN, OP_ASSIGN_FINAL))
- hashmap_clear_free_free(event->seclabel_list);
+ ordered_hashmap_clear_free_free(event->seclabel_list);
- r = hashmap_ensure_allocated(&event->seclabel_list, NULL);
+ r = ordered_hashmap_ensure_allocated(&event->seclabel_list, NULL);
if (r < 0)
return log_oom();
- r = hashmap_put(event->seclabel_list, name, label);
+ r = ordered_hashmap_put(event->seclabel_list, name, label);
if (r < 0)
return log_oom();
log_device_debug(dev, "SECLABEL{%s}='%s' %s:%u",
@@ -2443,9 +2443,9 @@ int udev_rules_apply_to_event(
_cleanup_free_ char *cmd = NULL;
if (IN_SET(cur->key.op, OP_ASSIGN, OP_ASSIGN_FINAL))
- hashmap_clear_free_key(event->run_list);
+ ordered_hashmap_clear_free_key(event->run_list);
- r = hashmap_ensure_allocated(&event->run_list, NULL);
+ r = ordered_hashmap_ensure_allocated(&event->run_list, NULL);
if (r < 0)
return log_oom();
@@ -2453,7 +2453,7 @@ int udev_rules_apply_to_event(
if (!cmd)
return log_oom();
- r = hashmap_put(event->run_list, cmd, INT_TO_PTR(cur->key.builtin_cmd));
+ r = ordered_hashmap_put(event->run_list, cmd, INT_TO_PTR(cur->key.builtin_cmd));
if (r < 0)
return log_oom();