summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mountbroker.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c13
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c8
4 files changed, 15 insertions, 14 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
index 14cbb3d5de0..50ce1484e62 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
@@ -276,6 +276,7 @@ make_georep_mountspec (gf_mount_spec_t *mspec, const char *volnames,
char *vols = NULL;
char *vol = NULL;
char *p = NULL;
+ char *savetok = NULL;
char *fa[3] = {0,};
size_t siz = 0;
int vc = 0;
@@ -296,7 +297,7 @@ make_georep_mountspec (gf_mount_spec_t *mspec, const char *volnames,
goto out;
for (p = vols;;) {
- vol = strtok (p, ",");
+ vol = strtok_r (p, ",", &savetok);
if (!vol) {
GF_ASSERT (vc == 0);
break;
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 83122cdee6f..067196952ce 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -199,15 +199,16 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
glusterd_brickinfo_t *src_brickinfo = NULL;
char *host = NULL;
char *path = NULL;
- char msg[2048] = {0};
+ char msg[2048] = {0};
char *dup_dstbrick = NULL;
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_brickinfo_t *dst_brickinfo = NULL;
- gf_boolean_t is_run = _gf_false;
+ gf_boolean_t is_run = _gf_false;
dict_t *ctx = NULL;
glusterd_conf_t *priv = NULL;
- char voldir[PATH_MAX] = {0};
- char pidfile[PATH_MAX] = {0};
+ char *savetok = NULL;
+ char voldir[PATH_MAX] = {0};
+ char pidfile[PATH_MAX] = {0};
priv = THIS->private;
GF_ASSERT (priv);
@@ -422,8 +423,8 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
gf_log ("", GF_LOG_ERROR, "Memory allocation failed");
goto out;
}
- host = strtok (dup_dstbrick, ":");
- path = strtok (NULL, ":");
+ host = strtok_r (dup_dstbrick, ":", &savetok);
+ path = strtok_r (NULL, ":", &savetok);
if (!host || !path) {
gf_log ("", GF_LOG_ERROR,
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index db26bbf2c10..173cf244146 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1108,6 +1108,7 @@ glusterd_store_read_and_tokenize (FILE *file, char *str,
glusterd_store_op_errno_t *store_errno)
{
int32_t ret = -1;
+ char *savetok = NULL;
GF_ASSERT (file);
GF_ASSERT (str);
@@ -1122,14 +1123,14 @@ glusterd_store_read_and_tokenize (FILE *file, char *str,
goto out;
}
- *iter_key = strtok (str, "=");
+ *iter_key = strtok_r (str, "=", &savetok);
if (*iter_key == NULL) {
ret = -1;
*store_errno = GD_STORE_KEY_NULL;
goto out;
}
- *iter_val = strtok (NULL, "=");
+ *iter_val = strtok_r (NULL, "=", &savetok);
if (*iter_key == NULL) {
ret = -1;
*store_errno = GD_STORE_VALUE_NULL;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 58b35cbddcb..6650043c175 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4552,9 +4552,8 @@ glusterd_sm_tr_log_transition_add_to_dict (dict_t *dict,
{
int ret = -1;
char key[512] = {0};
- char timestr[256] = {0,};
+ char timestr[64] = {0,};
char *str = NULL;
- struct tm tm = {0};
GF_ASSERT (dict);
GF_ASSERT (log);
@@ -4583,9 +4582,8 @@ glusterd_sm_tr_log_transition_add_to_dict (dict_t *dict,
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "log%d-time", count);
- localtime_r ((const time_t*)&log->transitions[i].time, &tm);
- memset (timestr, 0, sizeof (timestr));
- strftime (timestr, 256, "%Y-%m-%d %H:%M:%S", &tm);
+ gf_time_fmt (timestr, sizeof timestr, log->transitions[i].time,
+ gf_timefmt_FT);
str = gf_strdup (timestr);
ret = dict_set_dynstr (dict, key, str);
if (ret)