summaryrefslogtreecommitdiff
path: root/udevd.c
diff options
context:
space:
mode:
authorScott James Remnant <scott@ubuntu.com>2005-11-22 15:49:49 +0100
committerKay Sievers <kay.sievers@suse.de>2005-11-22 15:49:49 +0100
commit1b75f1096e8fdf2ec5ab4ec112f20b69fbd084c3 (patch)
tree0bbddffffc561532467d1e53e88095d3ce419698 /udevd.c
parent0da0efb2b622435209d183b49e2d16d426142b2c (diff)
clean-up empty queue directories
This allows scripts to do: while test -d /dev/.udev/queue; do sleep 0.1; done And don't create a failed symlink if there is another event for the same devpath in the queue.
Diffstat (limited to 'udevd.c')
-rw-r--r--udevd.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/udevd.c b/udevd.c
index 446db8fd33..25ef857a8c 100644
--- a/udevd.c
+++ b/udevd.c
@@ -176,6 +176,7 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state)
switch (state) {
case EVENT_QUEUED:
unlink(filename_failed);
+ delete_path(filename_failed);
strlcpy(target, sysfs_path, sizeof(target));
strlcat(target, msg->devpath, sizeof(target));
@@ -183,17 +184,26 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state)
symlink(target, filename);
return;
case EVENT_FINISHED:
+ case EVENT_FAILED:
unlink(filename_failed);
+ delete_path(filename_failed);
- /* don't remove if events for the same path are still pending */
+ /* don't remove, if events for the same path are still pending */
list_for_each_entry(loop_msg, &running_list, node)
if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0)
return;
- unlink(filename);
- return;
- case EVENT_FAILED:
- create_path(filename_failed);
- rename(filename, filename_failed);
+
+ /* move failed events to the failed directory */
+ if (state == EVENT_FAILED) {
+ create_path(filename_failed);
+ rename(filename, filename_failed);
+ } else {
+ unlink(filename);
+ }
+
+ /* clean up the queue directory */
+ delete_path(filename);
+
return;
}
}