summaryrefslogtreecommitdiff
path: root/udev/udev-node.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-12-10 01:13:35 +0100
committerKay Sievers <kay.sievers@vrfy.org>2010-12-10 01:18:15 +0100
commit4281da1fa6fda10c15bee984825fc607a8385004 (patch)
treec92eaab4296a31bcccd754dc2b23410025158ef1 /udev/udev-node.c
parentdc1791a9e6b59bd070a5f9c01b2214a1f8d69a82 (diff)
udevd: use dev_t or netif ifindex as database key
We need to preserve the database of network interfaces while we rename them. Use the kernel's numbers wherever possible, instead of the device names. Fix wrong database filenames which contain a '/', translated from '!' in the kernel name. Fix segfault for kobject pathes where the subsystem can not be determined from sysfs.
Diffstat (limited to 'udev/udev-node.c')
-rw-r--r--udev/udev-node.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c
index c8113f10b0..92634427f9 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -298,10 +298,8 @@ static void link_update(struct udev_device *dev, const char *slink, bool add)
dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev));
util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc));
- snprintf(dirname, sizeof(dirname), "%s/.udev/links/%s", udev_get_dev_path(udev), name_enc);
- snprintf(filename, sizeof(filename), "%s/%c%u:%u", dirname,
- strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c',
- major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)));
+ util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.udev/links/", name_enc, NULL);
+ util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL);
if (!add) {
dbg(udev, "removing index: '%s'\n", filename);