diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-replace-brick.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index 3ecb4f064f1..093548de712 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -266,6 +266,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, xlator_t *this = NULL; gf_boolean_t is_force = _gf_false; gsync_status_param_t param = {0,}; + char *c = NULL; this = THIS; GF_ASSERT (this); @@ -417,8 +418,18 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, GD_MSG_NO_MEMORY, "Memory allocation failed"); goto out; } - host = strtok_r (dup_dstbrick, ":", &savetok); - path = strtok_r (NULL, ":", &savetok); + + /* + * IPv4 address contains '.' and ipv6 addresses contains ':' + * So finding the last occurance of ':' to + * mark the start of brick path + */ + c = strrchr(dup_dstbrick, ':'); + if (c != NULL) { + c[0] = '\0'; + host = dup_dstbrick; + path = c++; + } if (!host || !path) { gf_msg (this->name, GF_LOG_ERROR, 0, |