msvcrt: Initialize writable environment block in env_set.
This commit is contained in:
parent
4843daaee1
commit
ae32b2f452
1 changed files with 3 additions and 5 deletions
|
@ -155,6 +155,7 @@ static int env_set(char **env, wchar_t **wenv)
|
|||
GetLastError() != ERROR_ENVVAR_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
if (env_init(FALSE, TRUE)) return -1;
|
||||
*eq = 0;
|
||||
idx = env_get_index(*env);
|
||||
*eq = '=';
|
||||
|
@ -180,6 +181,8 @@ static int env_set(char **env, wchar_t **wenv)
|
|||
}
|
||||
|
||||
if (!MSVCRT__wenviron) return 0;
|
||||
if (MSVCRT__wenviron == MSVCRT___winitenv)
|
||||
if (env_init(TRUE, TRUE)) return -1;
|
||||
idx = wenv_get_index(*wenv);
|
||||
*weq = '=';
|
||||
if (!weq[1])
|
||||
|
@ -264,11 +267,6 @@ static int putenv_helper(const char *name, const char *val, const char *eq)
|
|||
char *env;
|
||||
int r;
|
||||
|
||||
_lock(_ENV_LOCK);
|
||||
r = env_init(FALSE, TRUE);
|
||||
_unlock(_ENV_LOCK);
|
||||
if (r) return -1;
|
||||
|
||||
if (eq)
|
||||
{
|
||||
env = strdup(name);
|
||||
|
|
Loading…
Add table
Reference in a new issue