summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index e95af7af0..7ab9dc23c 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -774,8 +774,14 @@ static char *device_get_data(
str = get_vfs_attribute(dev, id);
break;
case COL_TARGET:
- str = xstrdup(lsblk_device_get_mountpoint(dev));
+ {
+ char *s = lsblk_device_get_mountpoint(dev);
+ if (s)
+ str = xstrdup(s);
+ else
+ str = NULL;
break;
+ }
case COL_LABEL:
prop = lsblk_device_get_properties(dev);
if (prop && prop->label)
@@ -1019,6 +1025,9 @@ static void device_to_scols(
DBG(DEV, ul_debugobj(dev, "add '%s' to scols", dev->name));
ON_DBG(DEV, if (ul_path_isopen_dirfd(dev->sysfs)) ul_debugobj(dev, " %s ---> is open!", dev->name));
+ if (!parent && dev->wholedisk)
+ parent = dev->wholedisk;
+
/* Do not print device more than one in --list mode */
if (!(lsblk->flags & LSBLK_TREE) && dev->is_printed)
return;