From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28710 invoked by alias); 25 Sep 2008 20:38:57 -0000 Received: (qmail 28703 invoked by alias); 25 Sep 2008 20:38:57 -0000 X-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_56,KAM_MX,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on bastion.fedora.phx.redhat.com X-Spam-Level: Subject: master - GFS: gfs_fsck invalid response to question changes the question To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 3a05914304d81a545c7022642f6f8e5cb3eda5da X-Git-Newrev: 66373d911c63c3077d3b00b57cf0e76a78844961 From: Bob Peterson Message-Id: <20080925203748.C2D42120438@lists.fedorahosted.org> Date: Thu, 25 Sep 2008 20:40:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00534.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=66373d911c63c3077d3b00b57cf0e76a78844961 Commit: 66373d911c63c3077d3b00b57cf0e76a78844961 Parent: 3a05914304d81a545c7022642f6f8e5cb3eda5da Author: Bob Peterson AuthorDate: Thu Sep 25 15:29:31 2008 -0500 Committer: Bob Peterson 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; }