From: Karel Zak Date: Fri, 15 Jun 2012 11:13:40 +0000 (+0200) Subject: lsblk: use fallback for TYPE X-Git-Tag: v2.22-rc1~275 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d738ff822c452fa855772f31db9ff90a63fb415;p=thirdparty%2Futil-linux.git lsblk: use fallback for TYPE ... bug introduced by 1edd8af70b4794c796d0faed0cf763ff3474b92e Signed-off-by: Karel Zak --- diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 6746f85a11..24fb44f6de 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -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++)