Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb31d071

Browse files
committed
Don't call SetEnvironmentVariable() when removing an environment variable,
as this seems to crash on at least some versions of MingW. Our current usageof this function does not require it, so it should be ok to ignore.
1 parent6d1e361 commitb31d071

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎src/port/win32env.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/port/win32env.c,v 1.1 2009/01/21 10:30:02 mha Exp $
13+
* $PostgreSQL: pgsql/src/port/win32env.c,v 1.2 2009/02/12 12:53:34 mha Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -64,12 +64,18 @@ pgwin32_putenv(const char *envval)
6464
return-1;
6565
*cp='\0';
6666
cp++;
67-
if (strlen(cp)==0)
68-
cp=NULL;
69-
if (!SetEnvironmentVariable(envcpy,cp))
67+
if (strlen(cp))
7068
{
71-
free(envcpy);
72-
return-1;
69+
/*
70+
* Only call SetEnvironmentVariable() when we are adding a variable,
71+
* not when removing it. Calling it on both crashes on at least certain
72+
* versions of MingW.
73+
*/
74+
if (!SetEnvironmentVariable(envcpy,cp))
75+
{
76+
free(envcpy);
77+
return-1;
78+
}
7379
}
7480
free(envcpy);
7581

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp