File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments