chiark / gitweb /
skip rule, if too may keys of the same type are used
authorKay Sievers <kay.sievers@suse.de>
Sun, 20 Aug 2006 16:15:29 +0000 (18:15 +0200)
committerKay Sievers <kay.sievers@suse.de>
Sun, 20 Aug 2006 16:15:29 +0000 (18:15 +0200)
test/udev-test.pl
udev_rules_parse.c

index c1c5302..c766232 100755 (executable)
@@ -79,7 +79,7 @@ EOF
                devpath         => "/block/sda/sda1",
                exp_name        => "boot_disk1" ,
                rules           => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", SYSFS{model}=="ST336605LW    !#", SYSFS{scsi_level}=="4", SYSFS{rev}=="B245", SYSFS{type}=="2", SYSFS{queue_depth}=="32", NAME="boot_diskXX%n"
+BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", SYSFS{model}=="ST336605LW    !#", SYSFS{scsi_level}=="4", SYSFS{rev}=="B245", SYSFS{type}=="0", SYSFS{queue_depth}=="32", NAME="boot_diskXX%n"
 BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", SYSFS{model}=="ST336605LW    !#", SYSFS{scsi_level}=="4", SYSFS{rev}=="B245", SYSFS{type}=="0", NAME="boot_disk%n"
 EOF
        },
index 5e93e60..d527bf4 100644 (file)
@@ -329,10 +329,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
                        }
                        attr = get_key_attribute(key + sizeof("ATTR")-1);
                        if (attr == NULL) {
-                               err("error parsing ATTR attribute in '%s'", line);
-                               continue;
+                               err("error parsing ATTR attribute");
+                               goto invalid;
                        }
-                       add_rule_key_pair(rule, &rule->attr, operation, attr, value);
+                       if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0)
+                               goto invalid;
                        valid = 1;
                        continue;
                }
@@ -381,10 +382,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
                        }
                        attr = get_key_attribute(key + sizeof("ATTRS")-1);
                        if (attr == NULL) {
-                               err("error parsing ATTRS attribute in '%s'", line);
-                               continue;
+                               err("error parsing ATTRS attribute");
+                               goto invalid;
                        }
-                       add_rule_key_pair(rule, &rule->attrs, operation, attr, value);
+                       if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0)
+                               goto invalid;
                        valid = 1;
                        continue;
                }
@@ -393,9 +395,10 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
                        attr = get_key_attribute(key + sizeof("ENV")-1);
                        if (attr == NULL) {
                                err("error parsing ENV attribute");
-                               continue;
+                               goto invalid;
                        }
-                       add_rule_key_pair(rule, &rule->env, operation, attr, value);
+                       if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0)
+                               goto invalid;
                        valid = 1;
                        continue;
                }