Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 54aa6cc

Browse files
committed
Make pgwin32_putenv() probe every known CRT, regardless of compiler.
This extends to MinGW builds the provision for MSVC-built libraries to see putenv() effects. Doing so repairs, for example, the handling of the krb_server_keyfile parameter when linked with MSVC-built MIT Kerberos. Like the previous commit, no back-patch.
1 parent 202dbdb commit 54aa6cc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/port/win32env.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pgwin32_putenv(const char *envval)
2121
{
2222
char *envcpy;
2323
char *cp;
24-
#ifdef _MSC_VER
2524
typedef int (_cdecl * PUTENVPROC) (const char *);
2625
static const char *const modulenames[] = {
2726
"msvcrt", /* Visual Studio 6.0 / MinGW */
@@ -45,7 +44,6 @@ pgwin32_putenv(const char *envval)
4544
NULL
4645
};
4746
int i;
48-
#endif /* _MSC_VER */
4947

5048
/*
5149
* Update process environment, making this change visible to child
@@ -88,7 +86,6 @@ pgwin32_putenv(const char *envval)
8886
* against. Addresses within these modules may become invalid the moment
8987
* we call FreeLibrary(), so don't cache them.
9088
*/
91-
#ifdef _MSC_VER
9289
for (i = 0; modulenames[i]; i++)
9390
{
9491
HMODULE hmodule = NULL;
@@ -104,9 +101,12 @@ pgwin32_putenv(const char *envval)
104101
FreeLibrary(hmodule);
105102
}
106103
}
107-
#endif /* _MSC_VER */
108104

109-
/* Finally, update our "own" cache */
105+
/*
106+
* Finally, update our "own" cache. This is redundant with the loop
107+
* above, except when PostgreSQL itself links to a CRT not listed above.
108+
* Ideally, the loop does visit all possible CRTs, making this redundant.
109+
*/
110110
return _putenv(envval);
111111
}
112112

0 commit comments

Comments
 (0)