mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-27 11:55:06 +00:00
Check if an fs is mounted before checking if it is mounted read-only.
Pointed out by: Mike Smith <msmith@freebsd.org>
This commit is contained in:
parent
0277da1675
commit
9ea6e95e0d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48916
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user