From 9d738ff822c452fa855772f31db9ff90a63fb415 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 15 Jun 2012 13:13:40 +0200 Subject: [PATCH] lsblk: use fallback for TYPE ... bug introduced by 1edd8af70b4794c796d0faed0cf763ff3474b92e Signed-off-by: Karel Zak --- misc-utils/lsblk.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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++) -- 2.47.3