From 85caf29cfd2f40ef10ed76d425bb89a5f8f45a1a Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 4 Mar 2018 17:28:43 -0500 Subject: mtab: Fall back on /proc/mounts if /etc/mtab isn't available --- mtab.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mtab.c') diff --git a/mtab.c b/mtab.c index e04f68f..363d3db 100644 --- a/mtab.c +++ b/mtab.c @@ -98,6 +98,10 @@ struct bfs_mtab *parse_bfs_mtab() { #if BFS_MNTENT FILE *file = setmntent(_PATH_MOUNTED, "r"); + if (!file) { + // In case we're in a chroot or something with /proc but no /etc/mtab + file = setmntent("/proc/mounts", "r"); + } if (!file) { goto fail; } -- cgit v1.2.3