This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: RHEL5 - GFS: gfs_fsck invalid response to question changesthe question


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=33d1825ca39c68db607226a59a895fa044e77ecd
Commit:        33d1825ca39c68db607226a59a895fa044e77ecd
Parent:        0f32c58025a75bcaf05f62b3ecd7e05e389c37eb
Author:        Bob Peterson <rpeterso@redhat.com>
AuthorDate:    Thu Sep 25 15:29:31 2008 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
CommitterDate: Tue Dec 16 08:56:35 2008 -0600

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 a69254d..5f5f685 100644
--- a/gfs/gfs_fsck/log.c
+++ b/gfs/gfs_fsck/log.c
@@ -93,10 +93,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)
@@ -120,6 +116,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 */
@@ -138,6 +138,7 @@ int query(struct fsck_sb *sbp, const char *format, ...)
 		while(response != '\n')
 			read(STDIN_FILENO, &response, sizeof(char));
 		printf("Bad response, please type 'y' or 'n'.\n");
+		va_end(args);
 		goto query;
 	}
 
@@ -150,6 +151,7 @@ int query(struct fsck_sb *sbp, const char *format, ...)
 		read(STDIN_FILENO, &response, sizeof(char));
 	}
 
+	va_end(args);
 	fsck_query = FALSE;
 	return ret;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]