mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
remove name from index if the node name has changed
Scott discovered that a changed rule, which renames a device node leaves the old node name around as a symlink. So drop the reference to the old name.
This commit is contained in:
parent
87702fa039
commit
8257730d39
@ -384,23 +384,27 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev
|
|||||||
if (found)
|
if (found)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
info(udev, "update old symlink '%s' no longer belonging to '%s'\n", name, udev_device_get_devpath(dev));
|
info(udev, "update old name, '%s' no longer belonging to '%s'\n",
|
||||||
|
name, udev_device_get_devpath(dev));
|
||||||
name_index(udev, udev_device_get_devpath(dev), name, 0);
|
name_index(udev, udev_device_get_devpath(dev), name, 0);
|
||||||
update_link(dev, name);
|
update_link(dev, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the node name has changed, delete the node,
|
* if the node name has changed, delete the node,
|
||||||
* and possibly restore a symlink of another device
|
* and possibly restore a symlink of a different device
|
||||||
*/
|
*/
|
||||||
devnode_old = udev_device_get_devnode(dev_old);
|
devnode_old = udev_device_get_devnode(dev_old);
|
||||||
if (devnode_old != NULL) {
|
if (devnode_old != NULL) {
|
||||||
const char *devnode = udev_device_get_devnode(dev);
|
const char *devnode = udev_device_get_devnode(dev);
|
||||||
|
|
||||||
if (devnode != NULL && strcmp(devnode_old, devnode) != 0)
|
if (devnode != NULL && strcmp(devnode_old, devnode) != 0) {
|
||||||
|
info(udev, "node has changed from '%s' to '%s'\n", devnode_old, devnode);
|
||||||
|
name_index(udev, udev_device_get_devpath(dev), devnode_old, 0);
|
||||||
update_link(dev, devnode_old);
|
update_link(dev, devnode_old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
|
int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user