summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-06-05 04:57:03 +0200
committerKay Sievers <kay.sievers@suse.de>2005-06-05 04:57:03 +0200
commitc974742bf4d6d8fab1e1c90e2e57dae0a2f297a1 (patch)
treef283bf62f4b8b63fb001e1f83382c9ac7848447c /udev_rules_parse.c
parenta15f42c46a7b9ceb5850ea4334c95f099ce74a6f (diff)
udev: allow final assignments :=
The use of KEY:=<value> will make the key unchangeable by later rules. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index e665957b81..3f07521ccb 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -89,6 +89,8 @@ static int get_key(char **line, char **key, enum key_operation *operation, char
break;
if (linepos[0] == '!')
break;
+ if (linepos[0] == ':')
+ break;
}
/* remember end of key */
@@ -115,6 +117,10 @@ static int get_key(char **line, char **key, enum key_operation *operation, char
*operation = KEY_OP_ASSIGN;
linepos++;
dbg("operator=assign");
+ } else if (linepos[0] == ':' && linepos[1] == '=') {
+ *operation = KEY_OP_ASSIGN_FINAL;
+ linepos += 2;
+ dbg("operator=assign_final");
} else
return -1;
@@ -364,30 +370,35 @@ static int rules_parse(const char *filename)
if (strcasecmp(key, KEY_SYMLINK) == 0) {
strlcpy(rule.symlink, value, sizeof(rule.symlink));
+ rule.symlink_operation = operation;
valid = 1;
continue;
}
if (strcasecmp(key, KEY_OWNER) == 0) {
strlcpy(rule.owner, value, sizeof(rule.owner));
+ rule.owner_operation = operation;
valid = 1;
continue;
}
if (strcasecmp(key, KEY_GROUP) == 0) {
strlcpy(rule.group, value, sizeof(rule.group));
+ rule.group_operation = operation;
valid = 1;
continue;
}
if (strcasecmp(key, KEY_MODE) == 0) {
rule.mode = strtol(value, NULL, 8);
+ rule.mode_operation = operation;
valid = 1;
continue;
}
if (strcasecmp(key, KEY_RUN) == 0) {
strlcpy(rule.run, value, sizeof(rule.run));
+ rule.run_operation = operation;
valid = 1;
continue;
}