summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-06-05 05:13:33 +0200
committerKay Sievers <kay.sievers@suse.de>2005-06-05 05:13:33 +0200
commit995aec875973e29caf42b037736349fc8839ee40 (patch)
treea1b9527ff13542eeca67f23e29ee9201b5d7f218 /udev_rules.c
parent6a522681e1438bbd9c317654cc35d5d206d378ad (diff)
udev: clear lists if a new value is assigned
Former values are cleared if SYMLINK=<value> is used. To add a value SYMLINK+=<value> is now needed. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/udev_rules.c b/udev_rules.c
index 42509f16ce..631cc4270a 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -782,6 +782,15 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d
if (rule->symlink_operation == KEY_OP_ASSIGN_FINAL)
udev->symlink_final = 1;
+ else if (rule->symlink_operation == KEY_OP_ASSIGN) {
+ struct name_entry *name_loop;
+ struct name_entry *temp_loop;
+
+ list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) {
+ list_del(&name_loop->node);
+ free(name_loop);
+ }
+ }
info("configured rule in '%s[%i]' applied, added symlink '%s'",
rule->config_file, rule->config_line, rule->symlink);
strlcpy(temp, rule->symlink, sizeof(temp));
@@ -821,6 +830,15 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d
if (rule->run_operation == KEY_OP_ASSIGN_FINAL)
udev->run_final = 1;
+ else if (rule->run_operation == KEY_OP_ASSIGN) {
+ struct name_entry *name_loop;
+ struct name_entry *temp_loop;
+
+ list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) {
+ list_del(&name_loop->node);
+ free(name_loop);
+ }
+ }
strlcpy(program, rule->run, sizeof(program));
apply_format(udev, program, sizeof(program), class_dev, sysfs_device);
dbg("add run '%s'", program);