diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-08-29 22:19:28 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-08-29 22:19:28 +0200 |
commit | a506e6298cffed4576f9cea8df15b2f8945fc731 (patch) | |
tree | c285fdfb02249674532c7c982a1b4abafc1fce70 | |
parent | a75689bad504e35e346b84960b2b604532b1d6b5 (diff) |
print warning for invalid TEST operations
-rw-r--r-- | udev_rules.c | 3 | ||||
-rw-r--r-- | udev_rules_parse.c | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/udev_rules.c b/udev_rules.c index 364d1b7adc..ef352ca2bc 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -994,7 +994,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } } - if (rule->test.operation != KEY_OP_UNSET) { + if (rule->test.operation == KEY_OP_MATCH || + rule->test.operation == KEY_OP_NOMATCH) { char filename[PATH_SIZE]; char devpath[PATH_SIZE]; char *attr; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 3afc31a0fa..9e435819f0 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -469,6 +469,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid TEST operation"); + goto invalid; + } attr = get_key_attribute(key + sizeof("TEST")-1); if (attr != NULL) rule->test_mode_mask = strtol(attr, NULL, 8); |