From b583363dcc0cf87b4ca27b99bca532da764e3a07 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Wed, 27 Jun 2012 11:04:48 +0530 Subject: glusterd: Fix peer probe when username/password is missing Prevent failure of building volumes dictionary during peer probe, when username/password for a volume is missing. This situation can be caused by migration of gluster from pre-3.3 to 3.3 and above. Change-Id: Ib924ecd3d941ddaa5c7773e4d45b076c488b6421 BUG: 834229 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.com/3619 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-utils.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 6650043c175..ab1156178b6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1730,24 +1730,20 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo, memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "volume%d.username", count); str = glusterd_auth_get_username (volinfo); - if (!str) { - ret = -1; - goto out; + if (str) { + ret = dict_set_dynstr (dict, key, gf_strdup (str)); + if (ret) + goto out; } - ret = dict_set_dynstr (dict, key, gf_strdup (str)); - if (ret) - goto out; memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "volume%d.password", count); str = glusterd_auth_get_password (volinfo); - if (!str) { - ret = -1; - goto out; + if (str) { + ret = dict_set_dynstr (dict, key, gf_strdup (str)); + if (ret) + goto out; } - ret = dict_set_dynstr (dict, key, gf_strdup (str)); - if (ret) - goto out; memset (key, 0, sizeof (key)); snprintf (key, 256, "volume%d."GLUSTERD_STORE_KEY_RB_STATUS, count); -- cgit