X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_rules_parse.c;h=02bddbd0a89c6fc9b041d608bcd6a6c7cc032cf6;hb=d419e96238f295996f5b8fc1743ab4835f62fcc2;hp=00b53285faf7796bce19e14d1b792a376955046b;hpb=273bebdba66cd5543dc1b076447e3275c81c221c;p=elogind.git diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 00b53285f..02bddbd0a 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 */ @@ -307,6 +304,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "DRIVER") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DRIVER operation"); + goto invalid; + } add_rule_key(rule, &rule->driver, operation, value); valid = 1; continue; @@ -374,7 +376,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncmp(attr, "device/", 7) == 0) err("the 'device' link is deprecated and will be removed from a future kernel, " "please fix it in %s:%u", filename, lineno); - else if (strchr(attr, '/') != NULL) + else if (strstr(attr, "../") != NULL) err("do not reference parent sysfs directories directly, that may break with a future kernel, " "please fix it in %s:%u", filename, lineno); if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) @@ -553,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; @@ -565,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;