From 31c817836c9c56eca1441b3b6f8b83db41c67f94 Mon Sep 17 00:00:00 2001 From: Basavanagowda Kanur Date: Wed, 11 Mar 2009 18:57:17 +0530 Subject: xlator.c option validation should check for empty valid options list (for strings). 'if (!opt->value)' always fails as 'value' member is an array of size ZR_OPTION_MAX_ARRAY_SIZE and is always non-null. it should have been 'if (opt->value[0] == NULL)' instead. Signed-off-by: Anand V. Avati --- libglusterfs/src/xlator.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 090fbc72708..9866081538f 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -45,6 +45,8 @@ } while (0) +#define GF_OPTION_LIST_EMPTY(_opt) (_opt->value[0] == NULL) + static void fill_defaults (xlator_t *xl) { @@ -246,10 +248,10 @@ _volume_option_value_validate (xlator_t *xl, case GF_OPTION_TYPE_STR: { /* Check if the '*str' is valid */ - if (!opt->value) { - ret = 0; - goto out; - } + if (GF_OPTION_LIST_EMPTY(opt)) { + ret = 0; + goto out; + } for (i = 0; (i < ZR_OPTION_MAX_ARRAY_SIZE) && opt->value[i]; i++) { -- cgit