[PATCH] 11/13 e2fsprogs-inuse_force - mke2fs -F safety
Andreas Dilger <[email protected]> Wed, 2 Aug 2006 11:00:58 -0600
| Newsgroups | gmane.comp.file-systems.ext2.devel |
|---|---|
| Message-ID | <[email protected]> |
Disambiguate the use of "-F" (force) flag for mke2fs to avoid dangerous
situations. The use of -F is needed for regular backing files and
for filesystems on whole block devices. It should NOT be confused
with mke2fs on an apparently-mounted or in-use filesystem.
Index: e2fsprogs/misc/mke2fs.c
===================================================================
--- e2fsprogs.orig/misc/mke2fs.c 2006-07-18 23:23:56.000000000 -0400
+++ e2fsprogs/misc/mke2fs.c 2006-07-18 23:24:35.000000000 -0400
@@ -1089,7 +1089,7 @@ static void PRS(int argc, char *argv[])
verbose = 1;
break;
case 'F':
- force = 1;
+ force++;
break;
case 'L':
volume_label = optarg;
Index: e2fsprogs/misc/util.c
===================================================================
--- e2fsprogs.orig/misc/util.c 2006-07-18 23:24:33.000000000 -0400
+++ e2fsprogs/misc/util.c 2006-07-18 23:24:35.000000000 -0400
@@ -154,7 +154,7 @@ void check_mount(const char *device, int
}
if (mount_flags & EXT2_MF_MOUNTED) {
fprintf(stderr, _("%s is mounted; "), device);
- if (force) {
+ if (force > 1) {
fputs(_("mke2fs forced anyway. Hope /etc/mtab is "
"incorrect.\n"), stderr);
return;
@@ -166,7 +166,7 @@ void check_mount(const char *device, int
if (mount_flags & EXT2_MF_BUSY) {
fprintf(stderr, _("%s is apparently in use by the system; "),
device);
- if (force) {
+ if (force > 2) {
fputs(_("mke2fs forced anyway.\n"), stderr);
return;
}
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV