X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcommon%2Fspawn-viewer.c;h=52be70526e5309e6c1ee10acefef030bf9238c39;hb=48a4000561343808724f7cb5fa8c131877489ccd;hp=26fe9199faab60fbbae724ebf3dd7922edb2a73f;hpb=dd392e9453fb7aa5f356ed1765db72ef33150461;p=lttng-tools.git diff --git a/src/common/spawn-viewer.c b/src/common/spawn-viewer.c index 26fe9199f..52be70526 100644 --- a/src/common/spawn-viewer.c +++ b/src/common/spawn-viewer.c @@ -7,15 +7,14 @@ * */ -#include #include #include #include #include -#include #include +#include #include "error.h" #include "macros.h" #include "spawn-viewer.h" @@ -69,7 +68,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 = NULL; /* Count number of arguments. */ do { @@ -91,13 +90,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++; } @@ -249,7 +248,7 @@ retry_viewer: * This function should never return if successfull because `execvp(3)` * onle returns if an error has occurred. */ - assert(ret != 0); + LTTNG_ASSERT(ret != 0); error: free(argv); return ret;