]> err.no Git - systemd/commitdiff
libudev: device - handle disk "device" link for partitions in deprecated sysfs layout
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 14 Nov 2008 17:26:49 +0000 (18:26 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 14 Nov 2008 17:26:49 +0000 (18:26 +0100)
Thanks to Mikhail Kolesnik <mike@openbunker.org> for finding this.

udev/lib/libudev-device.c

index eda3f5d97e26d8e3176849cc2432ca9f8b0cc2f0..c4714e4088d1a8dc6f1b5b0cc774fab307bf6e12 100644 (file)
@@ -501,9 +501,11 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic
            strncmp(udev_device->devpath, "/block/", 7) == 0) {
                util_strlcpy(path, udev_device->syspath, sizeof(path));
                util_strlcat(path, "/device", sizeof(path));
-               if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0)
+               if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) {
                        udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path);
-               return udev_device_parent;
+                       if (udev_device_parent != NULL)
+                               return udev_device_parent;
+               }
        }
 
        util_strlcpy(path, udev_device->syspath, sizeof(path));