summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurav <gaurav@gluster.com>2011-04-07 01:42:33 +0000
committerAnand Avati <avati@gluster.com>2011-06-19 20:41:27 -0700
commit58cf35b353f5a9fedfddd6da2f5811c58f1be3cc (patch)
tree4ced82326349bc752235e0123fd6e6322baa46a9
parent2f07f751bf69a196df85d3e715c0ad1a7a26419c (diff)
CLI : Display possible options in proper format.
Signed-off-by: Gaurav <gaurav@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2598 (Volume access option suceeds with any string value) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2598
-rw-r--r--libglusterfs/src/xlator.c16
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c8
2 files changed, 18 insertions, 6 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index f35c25183..9b91729ec 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -334,9 +334,13 @@ _volume_option_value_validate_attacherr (xlator_t *xl,
*/
char given_array[4096] = {0,};
for (i = 0; (i < ZR_OPTION_MAX_ARRAY_SIZE) &&
- opt->value[i]; i++) {
+ opt->value[i];) {
strcat (given_array, opt->value[i]);
- strcat (given_array, ", ");
+ if(((++i) < ZR_OPTION_MAX_ARRAY_SIZE) &&
+ (opt->value[i]))
+ strcat (given_array, ", ");
+ else
+ strcat (given_array, ".");
}
gf_log (xl->name, GF_LOG_ERROR,
@@ -819,9 +823,13 @@ _volume_option_value_validate (xlator_t *xl,
*/
char given_array[4096] = {0,};
for (i = 0; (i < ZR_OPTION_MAX_ARRAY_SIZE) &&
- opt->value[i]; i++) {
+ opt->value[i];) {
strcat (given_array, opt->value[i]);
- strcat (given_array, ", ");
+ if(((++i) < ZR_OPTION_MAX_ARRAY_SIZE) &&
+ (opt->value[i]))
+ strcat (given_array, ", ");
+ else
+ strcat (given_array, ".");
}
gf_log (xl->name, GF_LOG_ERROR,
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index c9387e145..89daa5a92 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -189,9 +189,13 @@ __volume_option_value_validate (char *name,
*/
char given_array[4096] = {0,};
for (i = 0; (i < ZR_OPTION_MAX_ARRAY_SIZE) &&
- opt->value[i]; i++) {
+ opt->value[i];) {
strcat (given_array, opt->value[i]);
- strcat (given_array, ", ");
+ if(((++i) < ZR_OPTION_MAX_ARRAY_SIZE) &&
+ (opt->value[i]))
+ strcat (given_array, ", ");
+ else
+ strcat (given_array, ".");
}
gf_log (name, GF_LOG_ERROR,