Skip to content

Commit d1ed336

Browse files
committed
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
1 parent 29f65a8 commit d1ed336

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/postmaster/syslogger.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,11 @@ SysLogger_Start(void)
593593
errmsg("could not redirect stderr: %m")));
594594
close(fd);
595595
_setmode(_fileno(stderr), _O_BINARY);
596-
/* Now we are done with the write end of the pipe. */
597-
CloseHandle(syslogPipe[1]);
596+
/*
597+
* Now we are done with the write end of the pipe.
598+
* CloseHandle() must not be called because the preceding
599+
* close() closes the underlying handle.
600+
*/
598601
syslogPipe[1] = 0;
599602
#endif
600603
redirection_done = true;

0 commit comments

Comments
 (0)