mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Don't call SetEnvironmentVariable() when removing an environment variable,
as this seems to crash on at least some versions of MingW. Our current usage of this function does not require it, so it should be ok to ignore.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/win32env.c,v 1.1 2009/01/21 10:30:02 mha Exp $
|
||||
* $PostgreSQL: pgsql/src/port/win32env.c,v 1.2 2009/02/12 12:53:34 mha Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -64,13 +64,19 @@ pgwin32_putenv(const char *envval)
|
||||
return -1;
|
||||
*cp = '\0';
|
||||
cp++;
|
||||
if (strlen(cp) == 0)
|
||||
cp = NULL;
|
||||
if (strlen(cp))
|
||||
{
|
||||
/*
|
||||
* Only call SetEnvironmentVariable() when we are adding a variable,
|
||||
* not when removing it. Calling it on both crashes on at least certain
|
||||
* versions of MingW.
|
||||
*/
|
||||
if (!SetEnvironmentVariable(envcpy, cp))
|
||||
{
|
||||
free(envcpy);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free(envcpy);
|
||||
|
||||
/* Finally, update our "own" cache */
|
||||
|
Reference in New Issue
Block a user