summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-01-16 21:15:53 +0100
committerKay Sievers <kay.sievers@vrfy.org>2009-01-16 21:15:53 +0100
commitfc7d16f993df6cef0e6038c63942d17994fde672 (patch)
tree420c8bad4af37baeed06e9d704bdcdca08ffa1ca
parent8257730d392cf227fd3eba2915021aad6a2cc2e4 (diff)
cleanup old names before creating the new names
Scott found that the node /dev/pktcdvd can not be replaced by /dev/pktcdvd/control by changing the rules, and re-trigger the event. We used to create the new names before we cleaned up the old ones, which can not work if we need to create subdir with the same name.
-rw-r--r--udev/udev-event.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c
index 6d05594337..4b00cab30d 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -582,22 +582,24 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
util_strlcat(filename, event->name, sizeof(filename));
udev_device_set_devnode(dev, filename);
- /* read current database entry */
+ /* read old database entry */
dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev));
if (dev_old != NULL) {
udev_device_read_db(dev_old);
udev_device_set_info_loaded(dev_old);
}
- /* update database, create node and symlinks */
+ /* write current database entry */
udev_device_update_db(dev);
- err = udev_node_add(dev, event->mode, event->uid, event->gid);
/* remove/update possible left-over symlinks from old database entry */
if (dev_old != NULL) {
udev_node_update_old_links(dev, dev_old);
udev_device_unref(dev_old);
}
+
+ /* create new node and symlinks */
+ err = udev_node_add(dev, event->mode, event->uid, event->gid);
goto exit;
}