@@ -75,12 +75,12 @@ ml_parse_models(struct ml_options *opt, const char *arg)
{
const char *delim = ",";
char models[PATH_MAX];
- char *token;
+ char *token, *sp = NULL;
int ret = 0;
strlcpy(models, arg, PATH_MAX);
- token = strtok(models, delim);
+ token = strtok_r(models, delim, &sp);
while (token != NULL) {
strlcpy(opt->filelist[opt->nb_filelist].model, token, PATH_MAX);
opt->nb_filelist++;
@@ -90,7 +90,7 @@ ml_parse_models(struct ml_options *opt, const char *arg)
ret = -EINVAL;
break;
}
- token = strtok(NULL, delim);
+ token = strtok_r(NULL, delim, &sp);
}
if (opt->nb_filelist == 0) {
@@ -106,7 +106,7 @@ ml_parse_filelist(struct ml_options *opt, const char *arg)
{
const char *delim = ",";
char filelist[PATH_MAX];
- char *token;
+ char *token, *sp = NULL;
if (opt->nb_filelist >= ML_TEST_MAX_MODELS) {
ml_err("Exceeded filelist count, max = %d\n", ML_TEST_MAX_MODELS);
@@ -116,7 +116,7 @@ ml_parse_filelist(struct ml_options *opt, const char *arg)
strlcpy(filelist, arg, PATH_MAX);
/* model */
- token = strtok(filelist, delim);
+ token = strtok_r(filelist, delim, &sp);
if (token == NULL) {
ml_err("Invalid filelist, model not specified = %s\n", arg);
return -EINVAL;
@@ -124,7 +124,7 @@ ml_parse_filelist(struct ml_options *opt, const char *arg)
strlcpy(opt->filelist[opt->nb_filelist].model, token, PATH_MAX);
/* input */
- token = strtok(NULL, delim);
+ token = strtok_r(NULL, delim, &sp);
if (token == NULL) {
ml_err("Invalid filelist, input not specified = %s\n", arg);
return -EINVAL;
@@ -132,7 +132,7 @@ ml_parse_filelist(struct ml_options *opt, const char *arg)
strlcpy(opt->filelist[opt->nb_filelist].input, token, PATH_MAX);
/* output */
- token = strtok(NULL, delim);
+ token = strtok_r(NULL, delim, &sp);
if (token == NULL) {
ml_err("Invalid filelist, output not specified = %s\n", arg);
return -EINVAL;
@@ -140,14 +140,14 @@ ml_parse_filelist(struct ml_options *opt, const char *arg)
strlcpy(opt->filelist[opt->nb_filelist].output, token, PATH_MAX);
/* reference - optional */
- token = strtok(NULL, delim);
+ token = strtok_r(NULL, delim, &sp);
if (token != NULL)
strlcpy(opt->filelist[opt->nb_filelist].reference, token, PATH_MAX);
else
memset(opt->filelist[opt->nb_filelist].reference, 0, PATH_MAX);
/* check for extra tokens */
- token = strtok(NULL, delim);
+ token = strtok_r(NULL, delim, &sp);
if (token != NULL) {
ml_err("Invalid filelist. Entries > 4\n.");
return -EINVAL;