aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2017-07-08 11:06:27 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2017-07-08 11:06:27 +0000
commit1f3aded0669b74605c87e2646440737f2ef425e3 (patch)
treeb3df1ae75162aec9d9f662ca9ac1737462fca535 /sbin/mount
parent2ca5f390c4431a77ff9a3f735d7e12a3312d4c97 (diff)
downloadsrc-1f3aded0669b74605c87e2646440737f2ef425e3.tar.gz
src-1f3aded0669b74605c87e2646440737f2ef425e3.zip
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
Notes
Notes: svn path=/head/; revision=320803
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/mount.c4
1 files changed, 3 insertions, 1 deletions
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;