summaryrefslogtreecommitdiff
path: root/udev/udev-watch.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-watch.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-watch.c')
-rw-r--r--udev/udev-watch.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/udev/udev-watch.c b/udev/udev-watch.c
index 5fa60101c4..9e1b8d8553 100644
--- a/udev/udev-watch.c
+++ b/udev/udev-watch.c
@@ -109,7 +109,6 @@ unlink:
void udev_watch_begin(struct udev *udev, struct udev_device *dev)
{
char filename[UTIL_PATH_SIZE];
- char majmin[UTIL_PATH_SIZE];
int wd;
if (inotify_fd < 0)
@@ -123,13 +122,10 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
return;
}
- snprintf(majmin, sizeof(majmin), "%c%i:%i",
- strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c',
- major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)));
snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd);
util_create_path(udev, filename);
unlink(filename);
- symlink(majmin, filename);
+ symlink(udev_device_get_id_filename(dev), filename);
udev_device_set_watch_handle(dev, wd);
}