diff options
author | Karel Zak | 2012-06-15 13:13:40 +0200 |
---|---|---|
committer | Karel Zak | 2012-06-15 13:13:40 +0200 |
commit | 9d738ff822c452fa855772f31db9ff90a63fb415 (patch) | |
tree | 53baf278ae4c6e67b06a9c936e5efee679d6a04b | |
parent | include/blkdev: cleanup up (diff) | |
download | kernel-qcow2-util-linux-9d738ff822c452fa855772f31db9ff90a63fb415.tar.gz kernel-qcow2-util-linux-9d738ff822c452fa855772f31db9ff90a63fb415.tar.xz kernel-qcow2-util-linux-9d738ff822c452fa855772f31db9ff90a63fb415.zip |
lsblk: use fallback for TYPE
... bug introduced by 1edd8af70b4794c796d0faed0cf763ff3474b92e
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | misc-utils/lsblk.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 6746f85a1..24fb44f6d 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++) |