]> err.no Git - systemd/commitdiff
libudev: return kernel provided devnode when asked before we handled any rules
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 22 Oct 2010 11:50:55 +0000 (13:50 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 22 Oct 2010 11:56:16 +0000 (13:56 +0200)
Makefile.am
libudev/libudev-device.c

index fd13005f353bf9b3bed0549bc6a64666f0eacc3f..4dbdfd97e3d6c89d8b1378fb7a3385f03df3c54b 100644 (file)
@@ -35,7 +35,7 @@ DISTCHECK_HOOKS =
 # libudev
 # ------------------------------------------------------------------------------
 LIBUDEV_CURRENT=9
-LIBUDEV_REVISION=2
+LIBUDEV_REVISION=3
 LIBUDEV_AGE=9
 
 SUBDIRS += libudev/docs
index e5f8cc3e46b765d2af84ebcfed0123c33db689d5..9b5d79ff4bf7e7caadd179794fa810f2497c16e5 100644 (file)
@@ -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;
 }