Set IGNORE_MTAB when running under NetBSD
authorNikolaus Rath <Nikolaus@rath.org>
Sat, 24 Dec 2016 02:47:01 +0000 (18:47 -0800)
committerNikolaus Rath <Nikolaus@rath.org>
Sat, 24 Dec 2016 02:47:01 +0000 (18:47 -0800)
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

configure.ac
lib/mount.c
lib/mount_util.c

index d51e10abbd2241dc8671045680b685febddd19bc..ab3ec7228b392a61d37add4a62ccb35d7a3783ae 100644 (file)
@@ -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
 
index 2f7e0687841e9815b9b6b47dcde1d8116ec0a09d..2150189d77817fc6c441b27c7ed174af2d748817 100644 (file)
@@ -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);
 
index 8b64ca209e65520c20753b6e22709e2ea6ef29e0..56ed85a4e08990e7694296584c5663bdcc71a948 100644 (file)
@@ -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)