]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/sysfs: fix sysfs_blkdev_get_wholedisk()
authorKarel Zak <kzak@redhat.com>
Tue, 29 May 2018 10:09:56 +0000 (12:09 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2018 11:07:46 +0000 (13:07 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/sysfs.c

index 953627715d982f6a79c22057f671d8aad8404713..fcfdc46bb894d4d7c1b32dd75cad2a940ca2bdfe 100644 (file)
@@ -601,7 +601,7 @@ int sysfs_blkdev_get_wholedisk(     struct path_cxt *pc,
         }
 
         if (diskdevno) {
-            *diskdevno = __sysfs_devname_to_devno(ul_path_get_prefix(pc), diskname, NULL);
+            *diskdevno = __sysfs_devname_to_devno(ul_path_get_prefix(pc), name, NULL);
             if (!*diskdevno)
                 goto err;
         }
@@ -868,6 +868,8 @@ static dev_t __sysfs_devname_to_devno(const char *prefix, const char *name, cons
        if (!prefix)
                prefix = "";
 
+       assert(name);
+
        if (strncmp("/dev/", name, 5) == 0) {
                /*
                 * Read from /dev