X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_rules_parse.c;h=e665957b81c652ac007d18871c3caaadf2c240a2;hb=b479b4887f5a0eb69b801645ab1b14636c4b06a2;hp=71ca4827288daca318dc9ba81ca5554ea93c0385;hpb=6b493a20e1dbf90a4e54d3be37027fa906220c31;p=elogind.git diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 71ca48272..e665957b8 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -236,7 +236,7 @@ static int rules_parse(const char *filename) while (1) { char *key; char *value; - enum key_operation operation = KEY_OP_UNKNOWN; + enum key_operation operation = KEY_OP_UNSET; retval = get_key(&linepos, &key, &operation, &value); if (retval) @@ -256,6 +256,13 @@ static int rules_parse(const char *filename) continue; } + if (strcasecmp(key, KEY_ACTION) == 0) { + strlcpy(rule.action, value, sizeof(rule.action)); + rule.action_operation = operation; + valid = 1; + continue; + } + if (strcasecmp(key, KEY_BUS) == 0) { strlcpy(rule.bus, value, sizeof(rule.bus)); rule.bus_operation = operation; @@ -379,6 +386,12 @@ static int rules_parse(const char *filename) continue; } + if (strcasecmp(key, KEY_RUN) == 0) { + strlcpy(rule.run, value, sizeof(rule.run)); + valid = 1; + continue; + } + if (strcasecmp(key, KEY_OPTIONS) == 0) { if (strstr(value, OPTION_LAST_RULE) != NULL) { dbg("last rule to be applied"); @@ -408,13 +421,6 @@ static int rules_parse(const char *filename) if (!valid) goto error; - /* simple plausibility checks for given keys */ - if ((rule.sysfs_pair[0].name[0] == '\0') ^ - (rule.sysfs_pair[0].value[0] == '\0')) { - err("inconsistency in " KEY_SYSFS " key"); - goto error; - } - if ((rule.result[0] != '\0') && (program_given == 0)) { info(KEY_RESULT " is only useful when " KEY_PROGRAM " is called in any rule before"); goto error;