gfs2-utils: master - gfs2_edit: Initialize metafds fully in savemetaopen

Andrew Price andyp at fedoraproject.org
Tue Sep 6 12:53:09 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=269f178ff858e4124c7bd6606a8ccfe41ea5358a
Commit:        269f178ff858e4124c7bd6606a8ccfe41ea5358a
Parent:        cc83b5b675e6e83dd0983ac96ddd9c6d4d1e36d3
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Thu Aug 25 12:49:48 2011 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Tue Sep 6 13:51:51 2011 +0100

gfs2_edit: Initialize metafds fully in savemetaopen

Coverity showed that savemetaopen() can return a metafd without
initializing the gzfd member. This isn't currently a problem as we only
use gzfd when it is set but this patch initializes the metafd fully to
avoid future problems.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/edit/savemeta.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 3a0e45e..9e5d111 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -211,7 +211,7 @@ static void warm_fuzzy_stuff(uint64_t wfsblock, int force)
  */
 static struct metafd savemetaopen(char *out_fn, int gziplevel)
 {
-	struct metafd mfd;
+	struct metafd mfd = {-1, NULL, NULL, gziplevel};
 	char gzmode[3] = "w9";
 	char dft_fn[] = DFT_SAVE_FILE;
 
@@ -233,7 +233,6 @@ static struct metafd savemetaopen(char *out_fn, int gziplevel)
 		exit(1);
 	}
 
-	mfd.gziplevel = gziplevel;
 	if (gziplevel > 0) {
 		gzmode[1] = '0' + gziplevel;
 		mfd.gzfd = gzdopen(mfd.fd, gzmode);


More information about the cluster-commits mailing list