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: REL9_2_BETA1~391 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2a2f7516bd27d4b2bcd387b2aa25a5b98d9c7b0;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 cea896a8f9..c331dd9de8 100644 --- a/src/backend/postmaster/syslogger.c +++ b/src/backend/postmaster/syslogger.c @@ -588,8 +588,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;