master - GFS: gfs_fsck invalid response to question changes the question
Bob Peterson
rpeterso@fedoraproject.org
Thu Sep 25 20:40:00 GMT 2008
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;
}
More information about the Cluster-cvs
mailing list