0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 9.0.1400: find_file_in_path() is not reentrant

Problem:    find_file_in_path() is not reentrant.
Solution:   Instead of global variables pass pointers to the functions.
            (closes #12093)
This commit is contained in:
Bram Moolenaar
2023-03-11 13:55:53 +00:00
parent 4df0772a41
commit 5145c9a829
6 changed files with 96 additions and 69 deletions

View File

@@ -2473,9 +2473,13 @@ vim_chdir(char_u *new_dir)
{
char_u *dir_name;
int r;
char_u *file_to_find = NULL;
char *search_ctx = NULL;
dir_name = find_directory_in_path(new_dir, (int)STRLEN(new_dir),
FNAME_MESS, curbuf->b_ffname);
FNAME_MESS, curbuf->b_ffname, &file_to_find, &search_ctx);
vim_free(file_to_find);
vim_findfile_cleanup(search_ctx);
if (dir_name == NULL)
return -1;
r = mch_chdir((char *)dir_name);