From 7fe3d3fe2b0bec8085b15fb4d9db8fdead826d57 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Sat, 20 Aug 2011 15:18:09 +0530 Subject: 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 Tested-by: Gluster Build System --- libglusterfs/src/options.c | 9 ++++++++- libglusterfs/src/xlator.c | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) 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; -- cgit