diff options
author | Peter Rajnoha | 2012-09-21 14:23:32 +0200 |
---|---|---|
committer | Karel Zak | 2012-10-02 10:23:51 +0200 |
commit | 8d687180b2efc4331bb9ce3145c207de0606815e (patch) | |
tree | b3777769c9399c8ede3b236b4a5b2a080a43f79d /misc-utils/lsblk.c | |
parent | su: don't modify PATH if -l not specified (diff) | |
download | kernel-qcow2-util-linux-8d687180b2efc4331bb9ce3145c207de0606815e.tar.gz kernel-qcow2-util-linux-8d687180b2efc4331bb9ce3145c207de0606815e.tar.xz kernel-qcow2-util-linux-8d687180b2efc4331bb9ce3145c207de0606815e.zip |
lsblk: fix reporting of 'part' type
Partitions are incorrectly marked with 'disk' type on
lsblk output while it should be marked as 'part' type.
Before:
$ lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-sda1 8:1 0 64M 0 disk
With this patch applied:
$ lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-sda1 8:1 0 64M 0 part
Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r-- | misc-utils/lsblk.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 2662460a4..26dfaf9f0 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -556,12 +556,12 @@ static char *get_type(struct blkdev_cxt *cxt) res = md_level ? md_level : xstrdup("md"); } else { - const char *type; + const char *type = NULL; int x = 0; - sysfs_read_int(&cxt->sysfs, "device/type", &x); + if (!sysfs_read_int(&cxt->sysfs, "device/type", &x)) + type = blkdev_scsi_type_to_name(x); - type = blkdev_scsi_type_to_name(x); if (!type) type = cxt->partition ? "part" : "disk"; res = xstrdup(type); |