chiark / gitweb /
fix default-name handling and NAME="" rules
[elogind.git] / udev_rules_parse.c
index 2ec9348b01c55e342c1e8b20f11cdd3f32b23e90..0021ec40be481eb14572978cde8a1b4492caba1a 100644 (file)
@@ -284,6 +284,12 @@ static int add_to_rules(struct udev_rules *rules, char *line)
                        continue;
                }
 
+               if (strcasecmp(key, "WAIT_FOR_SYSFS") == 0) {
+                       add_rule_key(rule, &rule->wait_for_sysfs, operation, value);
+                       valid = 1;
+                       continue;
+               }
+
                if (strncasecmp(key, "ENV", sizeof("ENV")-1) == 0) {
                        attr = get_key_attribute(key + sizeof("ENV")-1);
                        if (attr == NULL) {
@@ -359,7 +365,12 @@ static int add_to_rules(struct udev_rules *rules, char *line)
                                        rule->ignore_remove = 1;
                                }
                        }
-                       add_rule_key(rule, &rule->name, operation, value);
+                       if (value[0] == '\0') {
+                               dbg("name empty device should be ignored");
+                               rule->name.operation = operation;
+                               rule->ignore_device = 1;
+                       } else
+                               add_rule_key(rule, &rule->name, operation, value);
                        continue;
                }
 
@@ -371,7 +382,7 @@ static int add_to_rules(struct udev_rules *rules, char *line)
 
                if (strcasecmp(key, "OWNER") == 0) {
                        valid = 1;
-                       if (rules->resolve_names) {
+                       if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) {
                                char *endptr;
                                strtoul(value, &endptr, 10);
                                if (endptr[0] != '\0') {
@@ -390,7 +401,7 @@ static int add_to_rules(struct udev_rules *rules, char *line)
 
                if (strcasecmp(key, "GROUP") == 0) {
                        valid = 1;
-                       if (rules->resolve_names) {
+                       if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) {
                                char *endptr;
                                strtoul(value, &endptr, 10);
                                if (endptr[0] != '\0') {