summaryrefslogtreecommitdiff
path: root/udev/udevd.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-08-06 16:16:26 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-08-06 16:16:26 +0200
commitf7c5b04f69e004912327f082be8645b65bb1ff5d (patch)
tree7b3de9f37426e4b6b3204dd888950b027e235849 /udev/udevd.c
parent6e4025dfc8c2f6955d678b9f011c1d3b392a6e3e (diff)
re-enable failed event tracking
It did not work for the last couple of releases. If RUN{record_failed}+="..." is given, a non-zero execution will mark the event as failed. Recorded failed events can be re-triggered with: udevadm trigger --type=failed The failed tracking _might_ be useful for things which might not be ready to be executed at early bootup, but a bit later when the needed dependencies are available. In many cases though, it indicates that something is used in a way it should not.
Diffstat (limited to 'udev/udevd.c')
-rw-r--r--udev/udevd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index 69d509ce91..4024460d4b 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -165,7 +165,7 @@ static void event_queue_delete(struct event *event)
udev_list_node_remove(&event->node);
/* mark as failed, if "add" event returns non-zero */
- if (event->exitcode && strcmp(udev_device_get_action(event->dev), "add") == 0)
+ if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "add") == 0)
udev_queue_export_device_failed(udev_queue_export, event->dev);
else
udev_queue_export_device_finished(udev_queue_export, event->dev);
@@ -271,8 +271,9 @@ static void worker_new(struct event *event)
do {
struct udev_event *udev_event;
- struct worker_message msg;
+ struct worker_message msg = {};
int err;
+ int failed = 0;
info(event->udev, "seq %llu running\n", udev_device_get_seqnum(dev));
udev_event = udev_event_new(dev);
@@ -291,7 +292,7 @@ static void worker_new(struct event *event)
/* execute RUN= */
if (err == 0 && !udev_event->ignore_device && udev_get_run(udev_event->udev))
- udev_event_execute_run(udev_event);
+ failed = udev_event_execute_run(udev_event);
/* reset alarm */
alarm(0);
@@ -306,7 +307,10 @@ static void worker_new(struct event *event)
udev_monitor_send_device(worker_monitor, NULL, dev);
/* send back the result of the event execution */
- msg.exitcode = err;
+ if (err != 0)
+ msg.exitcode = err;
+ else if (failed != 0)
+ msg.exitcode = failed;
msg.pid = getpid();
send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0);