|
10 | 10 | *
|
11 | 11 | *
|
12 | 12 | * IDENTIFICATION
|
13 |
| - * $PostgreSQL: pgsql/src/port/win32env.c,v 1.3 2009/06/11 14:49:15 momjian Exp $ |
| 13 | + * $PostgreSQL: pgsql/src/port/win32env.c,v 1.4 2009/12/27 16:01:39 mha Exp $ |
14 | 14 | *
|
15 | 15 | *-------------------------------------------------------------------------
|
16 | 16 | */
|
@@ -40,15 +40,20 @@ pgwin32_putenv(const char *envval)
|
40 | 40 | if (putenvFunc==NULL)
|
41 | 41 | {
|
42 | 42 | hmodule=GetModuleHandle("msvcrt");
|
43 |
| -if (hmodule==NULL) |
44 |
| -return1; |
45 |
| -putenvFunc= (PUTENVPROC)GetProcAddress(hmodule,"_putenv"); |
46 |
| -if (putenvFunc==NULL) |
47 |
| -return1; |
| 43 | +if (hmodule!=NULL) |
| 44 | +{ |
| 45 | +/* |
| 46 | + * If the module is found, attempt to find the function. If not, that just |
| 47 | + * means we're not linked with msvcrt, so fall through and make our other |
| 48 | + * modifications anyway. |
| 49 | + * Ignore any errors and update whatever we can, since callers don't |
| 50 | + * check the return value anyway. |
| 51 | + */ |
| 52 | +putenvFunc= (PUTENVPROC)GetProcAddress(hmodule,"_putenv"); |
| 53 | +if (putenvFunc!=NULL) |
| 54 | +putenvFunc(envval); |
| 55 | +} |
48 | 56 | }
|
49 |
| -ret=putenvFunc(envval); |
50 |
| -if (ret!=0) |
51 |
| -returnret; |
52 | 57 | #endif/* _MSC_VER >= 1300 */
|
53 | 58 |
|
54 | 59 |
|
|