From: Karel Zak Date: Tue, 19 Jun 2018 10:22:59 +0000 (+0200) Subject: lsblk: follow --sysroot when read mountpoints X-Git-Tag: v2.33-rc1~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=caf1b443c073629cc2d70cca8251849cedcffd65;p=thirdparty%2Futil-linux.git lsblk: follow --sysroot when read mountpoints Signed-off-by: Karel Zak --- diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 26b58ab4e7..d797f6295e 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