Even though its current callers are all in single-threaded context
(lttng view and lttng-crash commands), it is a good practice to use
MT-safe APIs in library functions, in case those are ever used within a
multithreaded context in the future.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If419fd24b3bf6532f2c75a728a9ec395e365c626
{
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 {
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++;
}