X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev_rules_parse.c;h=bfbad367e9d41e4dfda8f806e5b737c08099bb3c;hp=3f7e43f83943f9807dab969e9277fd981814e121;hb=1d9cdcdf91f9ad0159be530a5b23170e73bffbe8;hpb=9dd0c2573b1e3a6f18356e4db6cee5e5329ecb67 diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 3f7e43f83..bfbad367e 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -104,12 +104,9 @@ static int get_key(char **line, char **key, enum key_operation *operation, char break; if (linepos[0] == '=') break; - if (linepos[0] == '+') - break; - if (linepos[0] == '!') - break; - if (linepos[0] == ':') - break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') + break; } /* remember end of key */ @@ -312,10 +309,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena err("invalid DRIVER operation"); goto invalid; } - err("DRIVER== will change in a future relase, " - "please use DRIVERS== in %s:%u", filename, lineno); - /* FIXME: this should be rule->driver to match only the event device */ - add_rule_key(rule, &rule->drivers, operation, value); + add_rule_key(rule, &rule->driver, operation, value); valid = 1; continue; } @@ -369,6 +363,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena 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 ATTRS operation"); + goto invalid; + } attr = get_key_attribute(key + sizeof("ATTRS")-1); if (attr == NULL) { err("error parsing ATTRS attribute"); @@ -556,6 +555,8 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "OPTIONS") == 0) { + const char *pos; + if (strstr(value, "last_rule") != NULL) { dbg("last rule to be applied"); rule->last_rule = 1; @@ -568,6 +569,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena dbg("remove event should be ignored"); rule->ignore_remove = 1; } + pos = strstr(value, "link_priority="); + if (pos != NULL) { + rule->link_priority = atoi(&pos[strlen("link_priority=")]); + info("link priority=%i", rule->link_priority); + } if (strstr(value, "all_partitions") != NULL) { dbg("creation of partition nodes requested"); rule->partitions = DEFAULT_PARTITIONS_COUNT;