Use strtok_r() instead of strtok()
This commit is contained in:
@@ -243,7 +243,7 @@ build_command_info(const char *command)
|
||||
static char *
|
||||
find_editor(int nfiles, char * const files[], char **argv_out[])
|
||||
{
|
||||
char *cp, **ep, **nargv, *editor, *editor_path;
|
||||
char *cp, *last, **ep, **nargv, *editor, *editor_path;
|
||||
int ac, i, nargc, wasblank;
|
||||
|
||||
/* Lookup EDITOR in user's environment. */
|
||||
@@ -275,7 +275,7 @@ find_editor(int nfiles, char * const files[], char **argv_out[])
|
||||
}
|
||||
}
|
||||
/* If we can't find the editor in the user's PATH, give up. */
|
||||
cp = strtok(editor, " \t");
|
||||
cp = strtok_r(editor, " \t", &last);
|
||||
if (cp == NULL ||
|
||||
(editor_path = find_in_path(editor, plugin_state.envp)) == NULL) {
|
||||
free(editor);
|
||||
@@ -291,7 +291,7 @@ find_editor(int nfiles, char * const files[], char **argv_out[])
|
||||
}
|
||||
for (ac = 0; cp != NULL && ac < nargc; ac++) {
|
||||
nargv[ac] = cp;
|
||||
cp = strtok(NULL, " \t");
|
||||
cp = strtok_r(NULL, " \t", &last);
|
||||
}
|
||||
nargv[ac++] = "--";
|
||||
for (i = 0; i < nfiles; )
|
||||
|
Reference in New Issue
Block a user