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>
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);