aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-12-23 18:47:01 -0800
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-12-23 18:47:01 -0800
commitac25c153691faea65cbfc1b0781b8b0dab3f4b29 (patch)
tree5f004ce125166290895fe2c359de93fde15db71f
parent0fa25d046fcf9ea737a2165310dcad53814ffa2f (diff)
Set IGNORE_MTAB when running under NetBSD
Apparently, NetBSD does not have /etc/mtab. Setting IGNORE_MTAB in this case makes the code a little nicer. See also https://github.com/libfuse/libfuse/pull/123
-rw-r--r--configure.ac3
-rw-r--r--lib/mount.c2
-rw-r--r--lib/mount_util.c5
3 files changed, 6 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index d51e10a..ab3ec72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,8 @@ fi
if test "$enable_test" != "no"; then
subdirs2="$subdirs2 test";
fi
-if test "$enable_mtab" = "no"; then
+if test "$enable_mtab" = "no" -o \
+ "$arch" = "netbsd"; then
AC_DEFINE(IGNORE_MTAB, 1, [Don't update /etc/mtab])
fi
diff --git a/lib/mount.c b/lib/mount.c
index 2f7e068..2150189 100644
--- a/lib/mount.c
+++ b/lib/mount.c
@@ -481,7 +481,6 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
goto out_close;
}
-#ifndef __NetBSD__
#ifndef IGNORE_MTAB
if (geteuid() == 0) {
char *newmnt = fuse_mnt_resolve_path("fuse", mnt);
@@ -496,7 +495,6 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
goto out_umount;
}
#endif /* IGNORE_MTAB */
-#endif /* __NetBSD__ */
free(type);
free(source);
diff --git a/lib/mount_util.c b/lib/mount_util.c
index 8b64ca2..56ed85a 100644
--- a/lib/mount_util.c
+++ b/lib/mount_util.c
@@ -30,6 +30,9 @@
#ifdef __NetBSD__
#define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
+#endif
+
+#ifdef IGNORE_MTAB
#define mtab_needs_update(mnt) 0
#else
static int mtab_needs_update(const char *mnt)
@@ -75,7 +78,7 @@ static int mtab_needs_update(const char *mnt)
return 1;
}
-#endif /* __NetBSD__ */
+#endif /* IGNORE_MTAB */
static int add_mount(const char *progname, const char *fsname,
const char *mnt, const char *type, const char *opts)