X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fspawn-viewer.c;h=1d668157f729e11e47f5fb199976c0b0a0b771d1;hp=26fe9199faab60fbbae724ebf3dd7922edb2a73f;hb=77368158bbbbdf027c10e701bda0baf8a480361b;hpb=dd392e9453fb7aa5f356ed1765db72ef33150461 diff --git a/src/common/spawn-viewer.c b/src/common/spawn-viewer.c index 26fe9199f..1d668157f 100644 --- a/src/common/spawn-viewer.c +++ b/src/common/spawn-viewer.c @@ -12,10 +12,10 @@ #include #include #include -#include #include +#include #include "error.h" #include "macros.h" #include "spawn-viewer.h" @@ -69,7 +69,7 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path) { int i = 0, ignore_space = 0; unsigned int num_opts = 1; - char **argv, *token = opts; + char **argv, *token = opts, *saveptr; /* Count number of arguments. */ do { @@ -91,13 +91,13 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path) goto error; } - token = strtok(opts, " "); + token = strtok_r(opts, " ", &saveptr); while (token != NULL) { argv[i] = strdup(token); if (argv[i] == NULL) { goto error; } - token = strtok(NULL, " "); + token = strtok_r(NULL, " ", &saveptr); i++; }