summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorErik van Konijnenburg <ekonijn@xs4all.nl>2008-05-19 09:05:20 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-05-19 09:05:20 +0200
commitff94cec3d71b5f46eb54645f4bc65e2d67ed5269 (patch)
treec514a58d2749fa05960d8b3afb12e3e54290c508 /udev_rules.c
parent4e548559bacf7a29fcdd2e5eb8a3ad8bfd5441fc (diff)
add substitution in MODE= field
Do substitition processing in MODE field, similar to substitution in OWNER, GROUP etc fields. Add test case for normal and overflow behaviour. Document in manpage.
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/udev_rules.c b/udev_rules.c
index 55a079be87..f4ee11a56c 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -1412,7 +1412,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev)
if (!udev->mode_final && rule->mode.operation != KEY_OP_UNSET) {
if (rule->mode.operation == KEY_OP_ASSIGN_FINAL)
udev->mode_final = 1;
- udev->mode = strtol(key_val(rule, &rule->mode), NULL, 8);
+ char buf[20];
+ strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf));
+ udev_rules_apply_format(udev, buf, sizeof(buf));
+ udev->mode = strtol(buf, NULL, 8);
dbg("applied mode=%#o to '%s'\n", udev->mode, udev->dev->kernel);
}
if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) {