From: Brian Behlendorf Date: Mon, 19 Mar 2007 12:25:38 +0000 (-0400) Subject: [COVERITY] Fix dead code bug in mke2fs X-Git-Tag: E2FSPROGS-1_40~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e066150a7034d39aaa8a65a280911e2ef8b3d48c;p=thirdparty%2Fe2fsprogs.git [COVERITY] Fix dead code bug in mke2fs 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 Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/ChangeLog b/misc/ChangeLog index bdeaf2342..7c32e5201 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,11 @@ +2007-03-19 Theodore Tso + + * 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 * tune2fs.c, mke2fs.c, e2initrd_helper.c, e2image.c, dumpe2fs.c: diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 2e72dcab6..f459a7cfd 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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;