]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
[COVERITY] Fix dead code bug in mke2fs
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 19 Mar 2007 12:25:38 +0000 (08:25 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 19 Mar 2007 12:25:38 +0000 (08:25 -0400)
If the fs_type is not specified and we are creating a journal device, to
use a fs_type of "journal"; this used to be the behavior before we added
support for the /etc/mke2fs.conf file, so let's fix it to restore the
old behavior.

Coverity ID: 4: Deadcode

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/ChangeLog
misc/mke2fs.c

index bdeaf23426d85afcadbd8acc793bd299d346731f..7c32e5201ece9eed0efd1e967b5e0d01ba6c094d 100644 (file)
@@ -1,3 +1,11 @@
+2007-03-19  Theodore Tso  <tytso@mit.edu>
+
+       * mke2fs.c (PRS): Fix deadcode bug detected by Coverity where if
+               the fs_type is not specified and we are creating a journal
+               device, to use a fs_type of "journal"; this used to be the
+               behavior before we added support for the /etc/mke2fs.conf
+               file, so let's fix it to restore the old behavior.
+
 2006-12-22  Theodore Tso  <tytso@mit.edu>
 
        * tune2fs.c, mke2fs.c, e2initrd_helper.c, e2image.c, dumpe2fs.c:
index 2e72dcab6e29e4202ca5d738c617e568cd800f76..f459a7cfd6b797de0849dd287a6d13f147750fe8 100644 (file)
@@ -1272,7 +1272,10 @@ static void PRS(int argc, char *argv[])
                int megs = (__u64)fs_param.s_blocks_count *
                        (EXT2_BLOCK_SIZE(&fs_param) / 1024) / 1024;
 
-               if (megs <= 3)
+               if (fs_param.s_feature_incompat & 
+                   EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
+                       fs_type = "journal";
+               else if (megs <= 3)
                        fs_type = "floppy";
                else if (megs <= 512)
                        fs_type = "small";
@@ -1337,8 +1340,6 @@ static void PRS(int argc, char *argv[])
 
        if (fs_param.s_feature_incompat & 
            EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
-               if (!fs_type)
-                       fs_type = "journal";
                reserved_ratio = 0;
                fs_param.s_feature_incompat = EXT3_FEATURE_INCOMPAT_JOURNAL_DEV;
                fs_param.s_feature_compat = 0;