summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorKarel Zak2018-06-19 12:22:59 +0200
committerKarel Zak2018-06-21 13:19:28 +0200
commitcaf1b443c073629cc2d70cca8251849cedcffd65 (patch)
treeeeea25e8435f08bba88fab9e7766527d869c102e /misc-utils
parentlsblk: use prefix for DM name (diff)
downloadkernel-qcow2-util-linux-caf1b443c073629cc2d70cca8251849cedcffd65.tar.gz
kernel-qcow2-util-linux-caf1b443c073629cc2d70cca8251849cedcffd65.tar.xz
kernel-qcow2-util-linux-caf1b443c073629cc2d70cca8251849cedcffd65.zip
lsblk: follow --sysroot when read mountpoints
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/lsblk.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 26b58ab4e..d797f6295 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -472,7 +472,14 @@ static int is_active_swap(const char *filename)
mnt_table_set_parser_errcb(swaps, table_parser_errcb);
mnt_table_set_cache(swaps, mntcache);
- mnt_table_parse_swaps(swaps, NULL);
+
+ if (!lsblk->sysroot)
+ mnt_table_parse_swaps(swaps, NULL);
+ else {
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "%s" _PATH_PROC_SWAPS, lsblk->sysroot);
+ mnt_table_parse_swaps(swaps, buf);
+ }
}
return mnt_table_find_srcpath(swaps, filename, MNT_ITER_BACKWARD) != NULL;
@@ -495,7 +502,14 @@ static char *get_device_mountpoint(struct blkdev_cxt *cxt)
mnt_table_set_parser_errcb(mtab, table_parser_errcb);
mnt_table_set_cache(mtab, mntcache);
- mnt_table_parse_mtab(mtab, NULL);
+
+ if (!lsblk->sysroot)
+ mnt_table_parse_mtab(mtab, NULL);
+ else {
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "%s" _PATH_PROC_MOUNTINFO, lsblk->sysroot);
+ mnt_table_parse_mtab(mtab, buf);
+ }
}
/* Note that maj:min in /proc/self/mountinfo does not have to match with