#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <errno.h>
#include <lttng/constant.h>
+#include <common/compat/errno.h>
#include "error.h"
#include "macros.h"
#include "spawn-viewer.h"
{
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 {
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++;
}