mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
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.
This commit is contained in:
parent
8257730d39
commit
fc7d16f993
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user