From 1f3aded0669b74605c87e2646440737f2ef425e3 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sat, 8 Jul 2017 11:06:27 +0000 Subject: [PATCH] Fix "mount -uw /" when the filesystem type doesn't match. This basically makes "mount -uw /" work when the filesystem mounted on / is NFS, but the one configured in fstab(5) is UFS, which can happen when you forget to modify fstab. Note that the whole special case ("else if (argv[0][0] == '/'") is probably not needed anyway. I'll take a look at removing it altogether; for now this is a minimally intrusive fix. MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11323 --- sbin/mount/mount.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index e474eac483e5..8b600e1f8cba 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -398,7 +398,9 @@ main(int argc, char *argv[]) have_fstab = 1; mntfromname = mntbuf->f_mntfromname; } else if (argv[0][0] == '/' && - argv[0][1] == '\0') { + argv[0][1] == '\0' && + strcmp(fs->fs_vfstype, + mntbuf->f_fstypename) == 0) { fs = getfsfile("/"); have_fstab = 1; mntfromname = fs->fs_spec;