]> err.no Git - systemd/commitdiff
print warning for invalid TEST operations
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 29 Aug 2007 20:19:28 +0000 (22:19 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 29 Aug 2007 20:19:28 +0000 (22:19 +0200)
udev_rules.c
udev_rules_parse.c

index 364d1b7adc727aec4d71df15fb62b9eb1ce613fc..ef352ca2bc4cef3adf24438538096254cb92d55f 100644 (file)
@@ -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;
index 3afc31a0fad8b7cb35d4a11ea9dc74da61fc4f46..9e435819f0893e2969cbeb05f976f3ed21eb2ec2 100644 (file)
@@ -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);