Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jul 2017 11:06:27 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320803 - head/sbin/mount
Message-ID:  <201707081106.v68B6RFq054941@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sat Jul  8 11:06:27 2017
New Revision: 320803
URL: https://svnweb.freebsd.org/changeset/base/320803

Log:
  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

Modified:
  head/sbin/mount/mount.c

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Sat Jul  8 09:28:31 2017	(r320802)
+++ head/sbin/mount/mount.c	Sat Jul  8 11:06:27 2017	(r320803)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707081106.v68B6RFq054941>