aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2012-02-21 17:12:25 +0100
committerMagnus Hagander <magnus@hagander.net>2012-02-21 17:14:36 +0100
commitf3ad4ca00e1f63357751d855a9150d3ba404a2b2 (patch)
treee78d9b4c19a1679c74f842badfbfb60b346eeef1
parent246b85a9484dda1cbead5c8c82d7fc8984b03794 (diff)
downloadpostgresql-f3ad4ca00e1f63357751d855a9150d3ba404a2b2.tar.gz
postgresql-f3ad4ca00e1f63357751d855a9150d3ba404a2b2.zip
Avoid double close of file handle in syslogger on win32
This causes an exception when running under a debugger or in particular when running on a debug version of Windows. Patch from MauMau
-rw-r--r--src/backend/postmaster/syslogger.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index deeb8d3f35b..71456614a55 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -594,8 +594,11 @@ SysLogger_Start(void)
errmsg("could not redirect stderr: %m")));
close(fd);
_setmode(_fileno(stderr), _O_BINARY);
- /* Now we are done with the write end of the pipe. */
- CloseHandle(syslogPipe[1]);
+ /*
+ * Now we are done with the write end of the pipe.
+ * CloseHandle() must not be called because the preceding
+ * close() closes the underlying handle.
+ */
syslogPipe[1] = 0;
#endif
redirection_done = true;