From: Magnus Hagander Date: Tue, 21 Feb 2012 16:12:25 +0000 (+0100) Subject: Avoid double close of file handle in syslogger on win32 X-Git-Tag: REL8_3_18~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3ad4ca00e1f63357751d855a9150d3ba404a2b2;p=postgresql 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 --- diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index deeb8d3f35..71456614a5 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;