X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_rules_parse.c;h=5603ee1d11fa83a26578e09ed2a521dd9c7882fa;hb=34bb5d057c99fa433392e0d5c17f604c8c111381;hp=d527bf4bad4a51c8ee397d697124d6a0042217a7;hpb=38895e573c6f17014393dc35a9e53d5f016172c3;p=elogind.git diff --git a/udev_rules_parse.c b/udev_rules_parse.c index d527bf4ba..5603ee1d1 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -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");