summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-05-01 01:45:26 +0200
committerKay Sievers <kay.sievers@suse.de>2006-05-01 01:45:26 +0200
commitb1c4f377c4989e0d881778b5a61f0d08b05c0a24 (patch)
tree44576b21eb36a3a9efcc7d7edb54a0816df4e2fd /udev_rules_parse.c
parenta5df2c57326c9ed2ec35a5965cf82d4dfeed598d (diff)
add more warnings for invalid key operations
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index 442ec65390..91cc9744fb 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -342,6 +342,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
}
if (strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) {
+ if (operation != KEY_OP_MATCH &&
+ operation != KEY_OP_NOMATCH) {
+ err("invalid SYSFS operation");
+ goto invalid;
+ }
attr = get_key_attribute(key + sizeof("SYSFS")-1);
if (attr == NULL) {
err("error parsing SYSFS attribute in '%s'", line);
@@ -421,12 +426,22 @@ 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;
}
if (strcasecmp(key, "RESULT") == 0) {
+ if (operation != KEY_OP_MATCH &&
+ operation != KEY_OP_NOMATCH) {
+ err("invalid RESULT operation");
+ goto invalid;
+ }
add_rule_key(rule, &rule->result, operation, value);
valid = 1;
continue;