summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-05-14 00:34:49 +0200
committerKay Sievers <kay@vrfy.org>2014-05-15 10:32:26 +0200
commit1ea972174baba40dbc80c51cbfc4edc49764b59b (patch)
treec208a821788d051ade3adecc695c9f2c5bee4460
parent19befb2d5fc087f96e40ddc432b2cc9385666209 (diff)
udev: do not skip the execution of RUN when renaming a network device fails
-rw-r--r--src/test/test-udev.c5
-rw-r--r--src/udev/udev-event.c11
-rw-r--r--src/udev/udev.h2
-rw-r--r--src/udev/udevadm-test.c13
-rw-r--r--src/udev/udevd.c5
5 files changed, 15 insertions, 21 deletions
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index b0647441f0..b057cc8c0f 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -155,9 +155,8 @@ int main(int argc, char *argv[]) {
}
}
- err = udev_event_execute_rules(event, rules, &sigmask_orig);
- if (err == 0)
- udev_event_execute_run(event, NULL);
+ udev_event_execute_rules(event, rules, &sigmask_orig);
+ udev_event_execute_run(event, NULL);
out:
if (event != NULL && event->fd_signal >= 0)
close(event->fd_signal);
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 2cab42bbc6..5213a4abaa 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -776,13 +776,12 @@ static int rename_netif(struct udev_event *event)
return r;
}
-int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask)
+void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask)
{
struct udev_device *dev = event->dev;
- int err = 0;
if (udev_device_get_subsystem(dev) == NULL)
- return -1;
+ return;
if (streq(udev_device_get_action(dev), "remove")) {
udev_device_read_db(dev, NULL);
@@ -816,9 +815,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
event->name != NULL && !streq(event->name, udev_device_get_sysname(dev))) {
char syspath[UTIL_PATH_SIZE];
char *pos;
+ int r;
- err = rename_netif(event);
- if (err == 0) {
+ r = rename_netif(event);
+ if (r >= 0) {
log_debug("renamed netif to '%s'", event->name);
/* remember old name */
@@ -881,7 +881,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules,
udev_device_unref(event->dev_db);
event->dev_db = NULL;
}
- return err;
}
void udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask)
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 936adfbf5e..62538bcb8d 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -84,7 +84,7 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string,
int udev_event_spawn(struct udev_event *event,
const char *cmd, char **envp, const sigset_t *sigmask,
char *result, size_t ressize);
-int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset);
+void udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset);
void udev_event_execute_run(struct udev_event *event, const sigset_t *sigset);
int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]);
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 6cd311b27d..6a2f5489fe 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -43,7 +43,6 @@ static int adm_test(struct udev *udev, int argc, char *argv[])
_cleanup_udev_device_unref_ struct udev_device *dev = NULL;
_cleanup_udev_event_unref_ struct udev_event *event = NULL;
sigset_t mask, sigmask_orig;
- int err;
int rc = 0, c;
static const struct option options[] = {
@@ -139,18 +138,16 @@ static int adm_test(struct udev *udev, int argc, char *argv[])
goto out;
}
- err = udev_event_execute_rules(event, rules, &sigmask_orig);
+ udev_event_execute_rules(event, rules, &sigmask_orig);
udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev))
printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry));
- if (err == 0) {
- udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) {
- char program[UTIL_PATH_SIZE];
+ udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) {
+ char program[UTIL_PATH_SIZE];
- udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program));
- printf("run: '%s'\n", program);
- }
+ udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program));
+ printf("run: '%s'\n", program);
}
out:
if (event != NULL && event->fd_signal >= 0)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index aecd208d40..bc0696c0ee 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -307,10 +307,9 @@ static void worker_new(struct event *event)
}
/* apply rules, create node, symlinks */
- err = udev_event_execute_rules(udev_event, rules, &sigmask_orig);
+ udev_event_execute_rules(udev_event, rules, &sigmask_orig);
- if (err == 0)
- udev_event_execute_run(udev_event, &sigmask_orig);
+ udev_event_execute_run(udev_event, &sigmask_orig);
/* apply/restore inotify watch */
if (err == 0 && udev_event->inotify_watch) {