public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: master - GFS: gfs_fsck invalid response to question changes the question
Date: Thu, 25 Sep 2008 20:40:00 -0000	[thread overview]
Message-ID: <20080925203748.C2D42120438@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=66373d911c63c3077d3b00b57cf0e76a78844961
Commit:        66373d911c63c3077d3b00b57cf0e76a78844961
Parent:        3a05914304d81a545c7022642f6f8e5cb3eda5da
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:38:16 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;
 }


                 reply	other threads:[~2008-09-25 20:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080925203748.C2D42120438@lists.fedorahosted.org \
    --to=rpeterso@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).