summaryrefslogtreecommitdiff
path: root/misc/util.c
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@clusterfs.com>2006-08-05 19:05:53 -0400
committerTheodore Ts'o <tytso@mit.edu>2006-08-05 19:05:53 -0400
commitc16e610c5100cd5829d969272af3035fac8e1a31 (patch)
treecd202f765170e2d0a3c3bf521a4f67cee02b3ebf /misc/util.c
parent8fe81a3d53fbaa1670ece5fb7fd11dd5ae45b8da (diff)
downloade2fsprogs-c16e610c5100cd5829d969272af3035fac8e1a31.tar.gz
Require mke2fs -F -F for really dangerous operations
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. Signed-off-by: Andreas Dilger <adilger@clusterfs.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc/util.c')
-rw-r--r--misc/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc/util.c b/misc/util.c
index d496c3e5..7cb952f8 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -154,7 +154,7 @@ void check_mount(const char *device, int force, const char *type)
}
if (mount_flags & EXT2_MF_MOUNTED) {
fprintf(stderr, _("%s is mounted; "), device);
- if (force) {
+ if (force > 2) {
fputs(_("mke2fs forced anyway. Hope /etc/mtab is "
"incorrect.\n"), stderr);
return;
@@ -166,7 +166,7 @@ void check_mount(const char *device, int force, const char *type)
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;
}