diff options
-rw-r--r-- | udev.c | 9 | ||||
-rw-r--r-- | udev_rules.c | 3 | ||||
-rw-r--r-- | udev_rules.h | 2 | ||||
-rw-r--r-- | udevd.c | 9 | ||||
-rw-r--r-- | udevstart.c | 9 |
5 files changed, 23 insertions, 9 deletions
@@ -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)); + } } } diff --git a/udev_rules.c b/udev_rules.c index e9d8d7560e..fbcbbe0083 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -362,7 +362,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) return -1; } -static void apply_format(struct udevice *udev, char *string, size_t maxsize) +void apply_format(struct udevice *udev, char *string, size_t maxsize) { char temp[PATH_SIZE]; char temp2[PATH_SIZE]; @@ -1017,7 +1017,6 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) name_list_cleanup(&udev->run_list); } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - apply_format(udev, program, sizeof(program)); dbg("add run '%s'", program); name_list_add(&udev->run_list, program, 0); } diff --git a/udev_rules.h b/udev_rules.h index 125babf1c5..b183d9b531 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -105,7 +105,7 @@ struct udev_rules { extern int udev_rules_init(struct udev_rules *rules, int resolve_names); extern void udev_rules_cleanup(struct udev_rules *rules); -extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize); +extern void apply_format(struct udevice *udev, char *string, size_t maxsize); extern void udev_rules_iter_init(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); @@ -123,10 +123,15 @@ static int udev_event_process(struct uevent_msg *msg) 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:")], msg->devpath, msg->action); - else - if (run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, + else { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + apply_format(udev, program, sizeof(program)); + if (run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO))) retval = -1; + } } } diff --git a/udevstart.c b/udevstart.c index 8c414f1acb..11bdf79183 100644 --- a/udevstart.c +++ b/udevstart.c @@ -160,8 +160,13 @@ run: 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:")], udev->dev->devpath, "add"); - 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)); + } } } exit: |