gfs2-utils: master - gfs2_edit: Fix savemeta compression for older zlibs

Andrew Price andyp at fedoraproject.org
Wed Jun 15 12:28:17 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=8331ddfd39725e0d206633488cf5582c252e9aa5
Commit:        8331ddfd39725e0d206633488cf5582c252e9aa5
Parent:        68f8a96419c8a60f2598bc2b8ea2830fb206a2ca
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Wed Jun 15 13:09:41 2011 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Wed Jun 15 13:09:41 2011 +0100

gfs2_edit: Fix savemeta compression for older zlibs

gzdopen in zlib 1.2.3 parses the mode string in a different way to
subsequent versions and the mode string we use causes the older gzwrite
to fail with EBADF. This patch fixes the mode string so that the
gzwrites succeed with the old and new zlibs.

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

diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 1797568..0c567da 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;
-	char gzmode[5] = "rwb9";
+	char gzmode[3] = "w9";
 	char dft_fn[] = DFT_SAVE_FILE;
 
 	if (!out_fn) {
@@ -234,7 +234,7 @@ static struct metafd savemetaopen(char *out_fn, int gziplevel)
 
 	mfd.gziplevel = gziplevel;
 	if (gziplevel > 0) {
-		gzmode[3] = '0' + gziplevel;
+		gzmode[1] = '0' + gziplevel;
 		mfd.gzfd = gzdopen(mfd.fd, gzmode);
 		if (!mfd.gzfd) {
 			fprintf(stderr, "gzdopen error: %s\n", strerror(errno));


More information about the cluster-commits mailing list