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.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