summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-03-04 17:28:43 -0500
committerTavian Barnes <tavianator@tavianator.com>2018-03-04 17:28:43 -0500
commit85caf29cfd2f40ef10ed76d425bb89a5f8f45a1a (patch)
tree04b92c8e68340547a38010b427d678475b382187
parent75ad5815156efe50e6a94be3c98a058d93717a89 (diff)
downloadbfs-85caf29cfd2f40ef10ed76d425bb89a5f8f45a1a.tar.xz
mtab: Fall back on /proc/mounts if /etc/mtab isn't available
-rw-r--r--mtab.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mtab.c b/mtab.c
index e04f68f..363d3db 100644
--- a/mtab.c
+++ b/mtab.c
@@ -99,6 +99,10 @@ struct bfs_mtab *parse_bfs_mtab() {
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;
}