summaryrefslogtreecommitdiffstats
path: root/sbin/tunefs/tunefs.c
diff options
context:
space:
mode:
authorluoqi <luoqi@FreeBSD.org>1999-07-19 21:04:25 +0000
committerluoqi <luoqi@FreeBSD.org>1999-07-19 21:04:25 +0000
commit2c32e3b9e73d5556e31d49faf844853533218fef (patch)
tree05714f9da6f7163d63f795b25e8651017448d8f0 /sbin/tunefs/tunefs.c
parent33ee2a3294f61aabfe73df4a2d17ab1a4d217d0d (diff)
downloadFreeBSD-src-2c32e3b9e73d5556e31d49faf844853533218fef.zip
FreeBSD-src-2c32e3b9e73d5556e31d49faf844853533218fef.tar.gz
Check if an fs is mounted before checking if it is mounted read-only.
Pointed out by: Mike Smith <msmith@freebsd.org>
Diffstat (limited to 'sbin/tunefs/tunefs.c')
-rw-r--r--sbin/tunefs/tunefs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index 8a32cb1..e002fa5 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)tunefs.c 8.2 (Berkeley) 4/19/94";
#endif
static const char rcsid[] =
- "$Id: tunefs.c,v 1.6 1998/08/03 06:41:20 charnier Exp $";
+ "$Id: tunefs.c,v 1.7 1999/01/20 01:22:39 luoqi Exp $";
#endif /* not lint */
/*
@@ -103,7 +103,8 @@ main(argc, argv)
special = argv[argc - 1];
fs = getfsfile(special);
if (fs) {
- if (statfs(special, &stfs) == 0) {
+ if (statfs(special, &stfs) == 0 &&
+ strcmp(special, stfs.f_mntonname) == 0) {
if ((stfs.f_flags & MNT_RDONLY) == 0) {
errx(1, "cannot work on read-write mounted file system");
}
OpenPOWER on IntegriCloud