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.
This commit is contained in:
parent
202dbdbe41
commit
54aa6ccfc5
@ -21,7 +21,6 @@ pgwin32_putenv(const char *envval)
|
|||||||
{
|
{
|
||||||
char *envcpy;
|
char *envcpy;
|
||||||
char *cp;
|
char *cp;
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef int (_cdecl * PUTENVPROC) (const char *);
|
typedef int (_cdecl * PUTENVPROC) (const char *);
|
||||||
static const char *const modulenames[] = {
|
static const char *const modulenames[] = {
|
||||||
"msvcrt", /* Visual Studio 6.0 / MinGW */
|
"msvcrt", /* Visual Studio 6.0 / MinGW */
|
||||||
@ -45,7 +44,6 @@ pgwin32_putenv(const char *envval)
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
#endif /* _MSC_VER */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update process environment, making this change visible to child
|
* Update process environment, making this change visible to child
|
||||||
@ -88,7 +86,6 @@ pgwin32_putenv(const char *envval)
|
|||||||
* against. Addresses within these modules may become invalid the moment
|
* against. Addresses within these modules may become invalid the moment
|
||||||
* we call FreeLibrary(), so don't cache them.
|
* we call FreeLibrary(), so don't cache them.
|
||||||
*/
|
*/
|
||||||
#ifdef _MSC_VER
|
|
||||||
for (i = 0; modulenames[i]; i++)
|
for (i = 0; modulenames[i]; i++)
|
||||||
{
|
{
|
||||||
HMODULE hmodule = NULL;
|
HMODULE hmodule = NULL;
|
||||||
@ -104,9 +101,12 @@ pgwin32_putenv(const char *envval)
|
|||||||
FreeLibrary(hmodule);
|
FreeLibrary(hmodule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* _MSC_VER */
|
|
||||||
|
|
||||||
/* Finally, update our "own" cache */
|
/*
|
||||||
|
* Finally, update our "own" cache. This is redundant with the loop
|
||||||
|
* above, except when PostgreSQL itself links to a CRT not listed above.
|
||||||
|
* Ideally, the loop does visit all possible CRTs, making this redundant.
|
||||||
|
*/
|
||||||
return _putenv(envval);
|
return _putenv(envval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user