summaryrefslogtreecommitdiff
path: root/udev.c
diff options
context:
space:
mode:
authorAndrey Borzenkov <arvidjaar@mail.ru>2006-01-24 20:10:48 +0100
committerKay Sievers <kay.sievers@suse.de>2006-01-24 20:10:48 +0100
commitf5f0c34f6dc32769fd788560ce0d0cac843872b2 (patch)
treef2010d2a36dc9f8fdb38fc227469c08bf419962f /udev.c
parent7d1e179f86aabeb5c206bf9b5bcac52235a9afbf (diff)
substitute format chars in RUN after rule matching
Apply substitutions before running a program, not while the rule is parsed. It allows to use environment variables set during rule processing as command arguments.
Diffstat (limited to 'udev.c')
-rw-r--r--udev.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/udev.c b/udev.c
index 4762ab1cef..f808abf427 100644
--- a/udev.c
+++ b/udev.c
@@ -161,8 +161,13 @@ int main(int argc, char *argv[], char *envp[])
list_for_each_entry(name_loop, &udev->run_list, node) {
if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0)
pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action);
- else
- run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
+ else {
+ char program[PATH_SIZE];
+
+ strlcpy(program, name_loop->name, sizeof(program));
+ apply_format(udev, program, sizeof(program));
+ run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
+ }
}
}