diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2010-10-22 13:50:55 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2010-10-22 13:56:16 +0200 |
commit | cdb1d7608a2e2ba708a890eeab6e5e99409a1953 (patch) | |
tree | 921ac6ff77bec9f6db4bc55fc03595076331c6d8 /libudev | |
parent | a74beafdcc05595cc0c07f75f51fe74057a61f28 (diff) |
libudev: return kernel provided devnode when asked before we handled any rules
Diffstat (limited to 'libudev')
-rw-r--r-- | libudev/libudev-device.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index e5f8cc3e46..9b5d79ff4b 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -876,8 +876,19 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; - if (!udev_device->info_loaded) + if (!udev_device->info_loaded) { + udev_device_read_uevent_file(udev_device); udev_device_read_db(udev_device); + } + + /* we might get called before we handled an event and have a db, use the kernel-provided name */ + if (udev_device->devnode == NULL && udev_device_get_knodename(udev_device) != NULL) { + if (asprintf(&udev_device->devnode, "%s/%s", + udev_get_dev_path(udev_device->udev), udev_device_get_knodename(udev_device)) < 0) + return NULL; + return udev_device->devnode; + } + return udev_device->devnode; } |