diff options
author | Basavanagowda Kanur <gowda@gluster.com> | 2009-03-11 18:57:17 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-03-12 16:10:24 +0530 |
commit | 31c817836c9c56eca1441b3b6f8b83db41c67f94 (patch) | |
tree | 7a01371cb1685845cf20c393ef83127572df0757 /libglusterfs | |
parent | b1c6a8507d59d16f9691652703be48f4539ca093 (diff) |
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 <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/xlator.c | 10 |
1 files 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++) { |