If the MSVCRT module is not found in the current binary, proceed to update
system and local environments anyway, instead of aborting. (This will happen in a MSVC build with no or very few external libraries linked in)
This commit is contained in:
parent
e5b457c2ac
commit
8c940a30ae
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/port/win32env.c,v 1.3 2009/06/11 14:49:15 momjian Exp $
|
* $PostgreSQL: pgsql/src/port/win32env.c,v 1.4 2009/12/27 16:01:39 mha Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -40,15 +40,20 @@ pgwin32_putenv(const char *envval)
|
|||||||
if (putenvFunc == NULL)
|
if (putenvFunc == NULL)
|
||||||
{
|
{
|
||||||
hmodule = GetModuleHandle("msvcrt");
|
hmodule = GetModuleHandle("msvcrt");
|
||||||
if (hmodule == NULL)
|
if (hmodule != NULL)
|
||||||
return 1;
|
{
|
||||||
putenvFunc = (PUTENVPROC) GetProcAddress(hmodule, "_putenv");
|
/*
|
||||||
if (putenvFunc == NULL)
|
* If the module is found, attempt to find the function. If not, that just
|
||||||
return 1;
|
* means we're not linked with msvcrt, so fall through and make our other
|
||||||
|
* modifications anyway.
|
||||||
|
* Ignore any errors and update whatever we can, since callers don't
|
||||||
|
* check the return value anyway.
|
||||||
|
*/
|
||||||
|
putenvFunc = (PUTENVPROC) GetProcAddress(hmodule, "_putenv");
|
||||||
|
if (putenvFunc != NULL)
|
||||||
|
putenvFunc(envval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ret = putenvFunc(envval);
|
|
||||||
if (ret != 0)
|
|
||||||
return ret;
|
|
||||||
#endif /* _MSC_VER >= 1300 */
|
#endif /* _MSC_VER >= 1300 */
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user