]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: fix force option to create filesystem on mounted device
authorKazuya Mio <k-mio@sx.jp.nec.com>
Mon, 16 Dec 2013 05:42:22 +0000 (00:42 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 16 Dec 2013 05:42:44 +0000 (00:42 -0500)
According to mke2fs man, we can create a filesystem on the mounted
device when -FF option is specified.

However, currently we have to specify -F option third to force mke2fs.
This patch fixes the problem.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/util.c

index 6c93e1c67ca227d9c854d856230464551e684c38..40c8858c2099badc88f6feed790f50a9db27df26 100644 (file)
@@ -150,7 +150,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 > 2) {
+               if (force >= 2) {
                        fputs(_("mke2fs forced anyway.  Hope /etc/mtab is "
                                "incorrect.\n"), stderr);
                        return;
@@ -162,7 +162,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 > 2) {
+               if (force >= 2) {
                        fputs(_("mke2fs forced anyway.\n"), stderr);
                        return;
                }