diff options
Diffstat (limited to 'misc-utils')
-rw-r--r-- | misc-utils/lsblk-devtree.c | 2 | ||||
-rw-r--r-- | misc-utils/lsblk.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/misc-utils/lsblk-devtree.c b/misc-utils/lsblk-devtree.c index a2aa26aed..4d15f70c1 100644 --- a/misc-utils/lsblk-devtree.c +++ b/misc-utils/lsblk-devtree.c @@ -384,6 +384,7 @@ static int device_dedupkey_is_equal( return 0; if (strcmp(dev->dedupkey, pattern->dedupkey) == 0) { if (!device_is_partition(dev) || + !dev->wholedisk->dedupkey || strcmp(dev->dedupkey, dev->wholedisk->dedupkey) != 0) { DBG(DEV, ul_debugobj(dev, "%s: match deduplication pattern", dev->name)); return 1; @@ -458,6 +459,7 @@ int lsblk_devtree_deduplicate_devices(struct lsblk_devtree *tr) if (!pattern->dedupkey) continue; if (device_is_partition(pattern) && + pattern->wholedisk->dedupkey && strcmp(pattern->dedupkey, pattern->wholedisk->dedupkey) == 0) continue; if (last && strcmp(pattern->dedupkey, last) == 0) 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; |