]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Avoid double close of file handle in syslogger on win32
authorMagnus Hagander <magnus@hagander.net>
Tue, 21 Feb 2012 16:12:25 +0000 (17:12 +0100)
committerMagnus Hagander <magnus@hagander.net>
Tue, 21 Feb 2012 16:14:36 +0000 (17:14 +0100)
This causes an exception when running under a debugger or in particular
when running on a debug version of Windows.

Patch from MauMau

src/backend/postmaster/syslogger.c

index deeb8d3f35b55df3cfa4b0643e65d27532a1fcf5..71456614a55a6831795010bd8f48a0fee83934d4 100644 (file)
@@ -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;