1
0
forked from aniani/vim

patch 8.2.4754: using cached values after unsetting some environment variables

Problem:    Still using cached values after unsetting some known environment
            variables.
Solution:   Take care of the side effects. (closes #10194)
This commit is contained in:
LemonBoy
2022-04-15 20:50:46 +01:00
committed by Bram Moolenaar
parent 31e5c60a68
commit 7714231bb5
8 changed files with 46 additions and 15 deletions

View File

@@ -1910,6 +1910,20 @@ vim_unsetenv(char_u *var)
#endif
}
/*
* Removes environment variable "name" and take care of side effects.
*/
void
vim_unsetenv_ext(char_u *var)
{
vim_unsetenv(var);
// "homedir" is not cleared, keep using the old value until $HOME is set.
if (STRICMP(var, "VIM") == 0)
didset_vim = FALSE;
else if (STRICMP(var, "VIMRUNTIME") == 0)
didset_vimruntime = FALSE;
}
/*
* Set environment variable "name" and take care of side effects.
@@ -1922,8 +1936,7 @@ vim_setenv_ext(char_u *name, char_u *val)
init_homedir();
else if (didset_vim && STRICMP(name, "VIM") == 0)
didset_vim = FALSE;
else if (didset_vimruntime
&& STRICMP(name, "VIMRUNTIME") == 0)
else if (didset_vimruntime && STRICMP(name, "VIMRUNTIME") == 0)
didset_vimruntime = FALSE;
}
#endif