diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2005-03-13 11:40:32 +0100 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:53:18 -0700 |
commit | 3e5958dee5f24283eb5c6a2d2d95e1a39428a3b8 (patch) | |
tree | baa33eae18ff92944084d140b3ff6049ce826b39 /udev_rules_parse.c | |
parent | 79f651f4bd2fb395a705792eb8ce551a6021bcd6 (diff) |
[PATCH] add ENV{} key to match agains environment variables
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r-- | udev_rules_parse.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c index c4c684d059..face496ab3 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -278,16 +278,36 @@ static int rules_parse(struct udevice *udev, const char *filename) goto error; } pair = &rule.sysfs_pair[rule.sysfs_pair_count]; - rule.sysfs_pair_count++; - attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1); if (attr == NULL) { dbg("error parsing " KEY_SYSFS " attribute"); + goto error; + } + strlcpy(pair->name, attr, sizeof(pair->name)); + strlcpy(pair->value, value, sizeof(pair->value)); + pair->operation = operation; + rule.sysfs_pair_count++; + valid = 1; + continue; + } + + if (strncasecmp(key, KEY_ENV, sizeof(KEY_ENV)-1) == 0) { + struct key_pair *pair; + + if (rule.env_pair_count >= KEY_ENV_PAIRS_MAX) { + dbg("skip rule, to many " KEY_ENV " keys in a single rule"); + goto error; + } + pair = &rule.env_pair[rule.env_pair_count]; + attr = get_key_attribute(key + sizeof(KEY_ENV)-1); + if (attr == NULL) { + dbg("error parsing " KEY_ENV " attribute"); continue; } strlcpy(pair->name, attr, sizeof(pair->name)); strlcpy(pair->value, value, sizeof(pair->value)); pair->operation = operation; + rule.env_pair_count++; valid = 1; continue; } |