summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2014-12-31 14:26:37 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-01-21 22:32:25 -0800
commitf74ff011fce5959884a4f47f0c87ae8795d64a24 (patch)
tree2990f7feab7cd56f36781f15da35a17c179c8d8b /xlators
parent217253b692610c4f6ce5d8426832c1d69844966c (diff)
glusterd: Fix strtok_r parsing.
Found a bug where a replica 2 volume creation prompts saying the bricks are in the same hosts even when they are in different hosts. Change-Id: Ie55addae55c55e32ad2b5339530ab71f0e3711ab BUG: 1091935 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/9373 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 0535fedd753..4c2c895decb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -88,6 +88,7 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
char *brick = NULL;
char *brick_list = NULL;
char *brick_list_dup = NULL;
+ char *brick_list_ptr = NULL;
char *tmpptr = NULL;
char *volname = NULL;
int32_t brick_count = 0;
@@ -160,12 +161,12 @@ glusterd_check_brick_order(dict_t *dict, char *err_str)
" found. Checking brick order.");
}
- brick_list_dup = gf_strdup(brick_list);
+ brick_list_dup = brick_list_ptr = gf_strdup(brick_list);
/* Resolve hostnames and get addrinfo */
while (i < brick_count) {
++i;
brick = strtok_r (brick_list_dup, " \n", &tmpptr);
- brick_list = tmpptr;
+ brick_list_dup = tmpptr;
if (brick == NULL)
goto check_failed;
brick = strtok_r (brick, ":", &tmpptr);
@@ -234,7 +235,7 @@ found_bad_brick_order:
ret = -1;
out:
ai_list_tmp2 = NULL;
- GF_FREE (brick_list_dup);
+ GF_FREE (brick_list_ptr);
list_for_each_entry (ai_list_tmp1, &ai_list->list, list) {
if (ai_list_tmp1->info)
freeaddrinfo (ai_list_tmp1->info);