]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: use fallback for TYPE
authorKarel Zak <kzak@redhat.com>
Fri, 15 Jun 2012 11:13:40 +0000 (13:13 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 15 Jun 2012 11:13:40 +0000 (13:13 +0200)
 ... bug introduced by 1edd8af70b4794c796d0faed0cf763ff3474b92e

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.c

index 6746f85a113a5ff3da2b0e9e4bcd1aa9cbcf775b..24fb44f6de3a477749d52f5184fca002d921d721 100644 (file)
@@ -510,10 +510,15 @@ static char *get_type(struct blkdev_cxt *cxt)
                res = md_level ? md_level : xstrdup("md");
 
        } else {
-               const char *type = cxt->partition ? "part" : "disk";
+               const char *type;
                int x = 0;
+
                sysfs_read_int(&cxt->sysfs, "device/type", &x);
-               res = blkdev_scsi_type_to_name(x);
+
+               type = blkdev_scsi_type_to_name(x);
+               if (!type)
+                       type = cxt->partition ? "part" : "disk";
+               res = xstrdup(type);
        }
 
        for (p = res; p && *p; p++)