Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c2a2f75

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 6b044cb commit c2a2f75

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
@@ -588,8 +588,11 @@ SysLogger_Start(void)
588588
errmsg("could not redirect stderr: %m")));
589589
close(fd);
590590
_setmode(_fileno(stderr), _O_BINARY);
591-
/* Now we are done with the write end of the pipe. */
592-
CloseHandle(syslogPipe[1]);
591+
/*
592+
* Now we are done with the write end of the pipe.
593+
* CloseHandle() must not be called because the preceding
594+
* close() closes the underlying handle.
595+
*/
593596
syslogPipe[1] = 0;
594597
#endif
595598
redirection_done = true;

0 commit comments

Comments
 (0)