[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2rc1-14-g2a9d3e3
Service Account
noreply at mpich.org
Mon Oct 26 09:47:10 CDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 2a9d3e328b92c579f008f2b6be8b778dc36ece7d (commit)
from e2628abe8dc97b400e290deab0ed9e1b321491f2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/2a9d3e328b92c579f008f2b6be8b778dc36ece7d
commit 2a9d3e328b92c579f008f2b6be8b778dc36ece7d
Author: Sangmin Seo <sseo at anl.gov>
Date: Mon Oct 12 20:07:43 2015 +0000
Use strtok_r to parse the same string recursively.
To parse the same string recursively, strtok_r() should be used instead
of strtok().
Signed-off-by: Pavan Balaji <balaji at anl.gov>
diff --git a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
index ba96f84..41885e0 100644
--- a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
+++ b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c
@@ -456,11 +456,12 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
exec->wdir = HYDU_strdup(info_val);
}
else if (!strcmp(info_key, "host") || !strcmp(info_key, "hosts")) {
- char *host = strtok(info_val, ",");
+ char *saveptr;
+ char *host = strtok_r(info_val, ",", &saveptr);
while (host) {
status = HYDU_process_mfile_token(host, 1, &pg->user_node_list);
HYDU_ERR_POP(status, "error creating node list\n");
- host = strtok(NULL, ",");
+ host = strtok_r(NULL, ",", &saveptr);
}
}
else if (!strcmp(info_key, "hostfile")) {
diff --git a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
index 3904164..2dc7d09 100644
--- a/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
+++ b/src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c
@@ -572,11 +572,12 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
exec->wdir = HYDU_strdup(info_val);
}
else if (!strcmp(info_key, "host") || !strcmp(info_key, "hosts")) {
- char *host = strtok(info_val, ",");
+ char *saveptr;
+ char *host = strtok_r(info_val, ",", &saveptr);
while (host) {
status = HYDU_process_mfile_token(host, 1, &pg->user_node_list);
HYDU_ERR_POP(status, "error creating node list\n");
- host = strtok(NULL, ",");
+ host = strtok_r(NULL, ",", &saveptr);
}
}
else if (!strcmp(info_key, "hostfile")) {
diff --git a/src/pm/hydra/utils/args/args.c b/src/pm/hydra/utils/args/args.c
index 929d7e0..8303bd7 100644
--- a/src/pm/hydra/utils/args/args.c
+++ b/src/pm/hydra/utils/args/args.c
@@ -258,22 +258,22 @@ char *HYDU_getcwd(void)
HYD_status HYDU_process_mfile_token(char *token, int newline, struct HYD_node **node_list)
{
int num_procs;
- char *hostname, *procs, *binding, *tmp, *user;
+ char *hostname, *procs, *binding, *tmp, *user, *saveptr;
struct HYD_node *node;
HYD_status status = HYD_SUCCESS;
if (newline) { /* The first entry gives the hostname and processes */
- hostname = strtok(token, ":");
- procs = strtok(NULL, ":");
+ hostname = strtok_r(token, ":", &saveptr);
+ procs = strtok_r(NULL, ":", &saveptr);
num_procs = procs ? atoi(procs) : 1;
status = HYDU_add_to_node_list(hostname, num_procs, node_list);
HYDU_ERR_POP(status, "unable to add to node list\n");
}
else { /* Not a new line */
- tmp = strtok(token, "=");
+ tmp = strtok_r(token, "=", &saveptr);
if (!strcmp(tmp, "binding")) {
- binding = strtok(NULL, "=");
+ binding = strtok_r(NULL, "=", &saveptr);
for (node = *node_list; node->next; node = node->next);
if (node->local_binding)
@@ -283,7 +283,7 @@ HYD_status HYDU_process_mfile_token(char *token, int newline, struct HYD_node **
node->local_binding = HYDU_strdup(binding);
}
else if (!strcmp(tmp, "user")) {
- user = strtok(NULL, "=");
+ user = strtok_r(NULL, "=", &saveptr);
for (node = *node_list; node->next; node = node->next);
if (node->user)
-----------------------------------------------------------------------
Summary of changes:
src/pm/hydra/pm/pmiserv/pmiserv_pmi_v1.c | 5 +++--
src/pm/hydra/pm/pmiserv/pmiserv_pmi_v2.c | 5 +++--
src/pm/hydra/utils/args/args.c | 12 ++++++------
3 files changed, 12 insertions(+), 10 deletions(-)
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list