diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-18 15:50:16 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-18 15:50:16 +0200 |
commit | 2d73813ebc5a9b507655ec629ba8b40e4fbf28a8 (patch) | |
tree | 9da32c651652d51364790ca4c2127fcc4686d98e /udev/udev-event.c | |
parent | dcdcb8cc06c044a0429a688266799838e914f88d (diff) |
udev_rules_run() -> udev_event_execute_run();
Diffstat (limited to 'udev/udev-event.c')
-rw-r--r-- | udev/udev-event.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c index fe4dcec4e1..b7c3ff142a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -282,3 +282,36 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) exit: return err; } + +int udev_event_execute_run(struct udev_event *event) +{ + struct udev_list_entry *list_entry; + int err = 0; + + dbg(event->udev, "executing run list\n"); + udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { + const char *cmd = udev_list_entry_get_name(list_entry); + + if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { + struct udev_monitor *monitor; + + monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); + if (monitor == NULL) + continue; + udev_monitor_send_device(monitor, event->dev); + udev_monitor_unref(monitor); + } else { + char program[UTIL_PATH_SIZE]; + char **envp; + + util_strlcpy(program, cmd, sizeof(program)); + udev_rules_apply_format(event, program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { + if (!udev_list_entry_get_flag(list_entry)) + err = -1; + } + } + } + return err; +} |