chiark / gitweb /
use fnmatch() instead of our own pattern match code
[elogind.git] / udev_rules_parse.c
index d527bf4bad4a51c8ee397d697124d6a0042217a7..5603ee1d11fa83a26578e09ed2a521dd9c7882fa 100644 (file)
@@ -219,7 +219,7 @@ static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs,
        size_t key_len = strnlen(key, PATH_SIZE);
 
        if (pairs->count >= PAIRS_MAX) {
-               err("skip, too many keys in a single rule");
+               err("skip, too many keys of the same type in a single rule");
                return -1;
        }
 
@@ -321,12 +321,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
                        continue;
                }
 
-               if (strncasecmp(key, "ATTR", sizeof("ATTR")-1) == 0) {
-                       if (operation != KEY_OP_MATCH &&
-                           operation != KEY_OP_NOMATCH) {
-                               err("invalid ATTR operation");
-                               goto invalid;
-                       }
+               if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) {
                        attr = get_key_attribute(key + sizeof("ATTR")-1);
                        if (attr == NULL) {
                                err("error parsing ATTR attribute");
@@ -350,7 +345,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
                        continue;
                }
 
-               if (strcasecmp(key, "SUBSYTEMS") == 0 ||
+               if (strcasecmp(key, "SUBSYSTEMS") == 0 ||
                    strcasecmp(key, "BUS") == 0) {
                        if (operation != KEY_OP_MATCH &&
                            operation != KEY_OP_NOMATCH) {
@@ -373,13 +368,8 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
                        continue;
                }
 
-               if (strncasecmp(key, "ATTRS", sizeof("ATTRS")-1) == 0 ||
-                   strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) {
-                       if (operation != KEY_OP_MATCH &&
-                           operation != KEY_OP_NOMATCH) {
-                               err("invalid ATTRSS operation");
-                               goto invalid;
-                       }
+               if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 ||
+                   strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) {
                        attr = get_key_attribute(key + sizeof("ATTRS")-1);
                        if (attr == NULL) {
                                err("error parsing ATTRS attribute");
@@ -391,7 +381,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
                        continue;
                }
 
-               if (strncasecmp(key, "ENV", sizeof("ENV")-1) == 0) {
+               if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) {
                        attr = get_key_attribute(key + sizeof("ENV")-1);
                        if (attr == NULL) {
                                err("error parsing ENV attribute");