summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2011-08-20 15:18:09 +0530
committerVijay Bellur <vijay@gluster.com>2011-08-20 03:08:18 -0700
commit7fe3d3fe2b0bec8085b15fb4d9db8fdead826d57 (patch)
treeffdfe8ad434e6c644bc291dca3bd4b8a8e34104f /libglusterfs
parent7c6cf654700fb05502591e84b2000bb5230283e2 (diff)
libglusterfs: Fix a crash in gluster volume set help
Change-Id: I585e8e685f5c23b6fa632ef708adf2e349ba6704 BUG: 3415 Reviewed-on: http://review.gluster.com/274 Reviewed-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/options.c9
-rw-r--r--libglusterfs/src/xlator.c1
2 files changed, 9 insertions, 1 deletions
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index dee3c91854f..ccd57e4f07f 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -567,12 +567,19 @@ static volume_option_t *
xlator_volume_option_get_list (volume_opt_list_t *vol_list, const char *key)
{
volume_option_t *opt = NULL;
+ volume_opt_list_t *opt_list = NULL;
volume_option_t *found = NULL;
int index = 0;
int i = 0;
char *cmp_key = NULL;
- opt = vol_list->given_opt;
+ if (!vol_list->given_opt) {
+ opt_list = list_entry (vol_list->list.next, volume_opt_list_t,
+ list);
+ opt = opt_list->given_opt;
+ } else
+ opt = vol_list->given_opt;
+
for (index = 0; opt[index].key && opt[index].key[0]; index++) {
for (i = 0; i < ZR_VOLUME_MAX_NUM_KEY; i++) {
cmp_key = opt[index].key[i];
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 67ecabce576..e826228ed31 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -170,6 +170,7 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle,
gf_log ("xlator", GF_LOG_DEBUG,
"Strict option validation not enforced -- neglecting");
}
+ INIT_LIST_HEAD (&vol_opt->list);
list_add_tail (&vol_opt->list, &opt_list->list);
ret = 0;