git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 799c0d3)
Don't pass an invalid file handle to dup2(). That causes a crash on
Thu, 1 Apr 2010 20:12:22 +0000 (20:12 +0000)
Thu, 1 Apr 2010 20:12:22 +0000 (20:12 +0000)
Windows, thanks to a feature in CRT called Parameter Validation.

Backpatch to 8.2, which is the oldest version supported on Windows. In
8.2 and 8.3 also backpatch the earlier change to use DEVNULL instead of
NULL_DEV #define for a /dev/null-like device. NULL_DEV was hard-coded to
"/dev/null" regardless of platform, which didn't work on Windows, while
DEVNULL works on all platforms. Restarting syslogger didn't work on
Windows on versions 8.3 and below because of that.


diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index 5c9eaf461973c4d757d858fe857cf4203c92aacc..304dc574d864d1fa869e22151189e57e50e42f94 100644 (file)
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -18,7 +18,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.55 2010年01月02日 16:57:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.56 2010年04月01日 20:12:22 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -194,9 +194,12 @@ SysLoggerMain(int argc, char *argv[])
*/
close(fileno(stdout));
close(fileno(stderr));
- dup2(fd, fileno(stdout));
- dup2(fd, fileno(stderr));
- close(fd);
+ if (fd != -1)
+ {
+ dup2(fd, fileno(stdout));
+ dup2(fd, fileno(stderr));
+ close(fd);
+ }
}
/*
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /