public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* STABLE2 - GFS: gfs_fsck invalid response to question changes the question
@ 2008-09-25 21:34 Bob Peterson
  0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2008-09-25 21:34 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=fedd56b97fdc9b9bb2fa47958d14b9a324c4df3b
Commit:        fedd56b97fdc9b9bb2fa47958d14b9a324c4df3b
Parent:        27ab4fdb8adc64f51663102d1e1a537d175c0403
Author:        Bob Peterson <rpeterso@redhat.com>
AuthorDate:    Thu Sep 25 15:29:31 2008 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
CommitterDate: Thu Sep 25 15:40:46 2008 -0500

GFS: gfs_fsck invalid response to question changes the question

bz 463817 -  gfs_fsck can't decide which bitmap to fix

When the gfs_fsck ran into a problem and asked whether to fix
it, if the users gave an invalid response, the block referenced
in the question would become a random number.  That's because in
function "query" it was parsing the arguments once, using
the va_start function, but after the arguments have been parsed,
it's left in an invalid state.  The proper thing to do is to
call va_start for each time we need to parse the arguments.
---
 gfs/gfs_fsck/log.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gfs/gfs_fsck/log.c b/gfs/gfs_fsck/log.c
index 9c89683..3730d41 100644
--- a/gfs/gfs_fsck/log.c
+++ b/gfs/gfs_fsck/log.c
@@ -81,10 +81,6 @@ int query(struct fsck_sb *sbp, const char *format, ...)
 	int err = 0;
 	int ret = 0;
 
-	va_start(args, format);
-
-	transform = _(format);
-
 	if(sbp->opts->yes)
 		return 1;
 	if(sbp->opts->no)
@@ -108,6 +104,10 @@ int query(struct fsck_sb *sbp, const char *format, ...)
 
 	}
  query:
+	va_start(args, format);
+
+	transform = _(format);
+
 	vprintf(transform, args);
 
 	/* Make sure query is printed out */
@@ -126,6 +126,7 @@ int query(struct fsck_sb *sbp, const char *format, ...)
 		while(response != '\n')
 			err = read(STDIN_FILENO, &response, sizeof(char));
 		printf("Bad response, please type 'y' or 'n'.\n");
+		va_end(args);
 		goto query;
 	}
 
@@ -138,6 +139,7 @@ int query(struct fsck_sb *sbp, const char *format, ...)
 		err = read(STDIN_FILENO, &response, sizeof(char));
 	}
 
+	va_end(args);
 	fsck_query = FALSE;
 	return ret;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-25 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-25 21:34 STABLE2 - GFS: gfs_fsck invalid response to question changes the question Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).