diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 636b12f737f..5e705a36b4f 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.551.2.5 2009/12/02 17:41:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.551.2.6 2010/04/01 20:12:34 heikki Exp $ * * NOTES * @@ -1174,7 +1174,7 @@ pmdaemonize(void) ExitPostmaster(1); } #endif - i = open(NULL_DEV, O_RDWR, 0); + i = open(DEVNULL, O_RDWR, 0); dup2(i, 0); dup2(i, 1); dup2(i, 2); diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index 198ca263247..3b1ad0b0f3c 100644 --- 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.44.2.2 2009/11/19 02:45:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.44.2.3 2010/04/01 20:12:34 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -184,7 +184,7 @@ SysLoggerMain(int argc, char *argv[]) */ if (redirection_done) { - int fd = open(NULL_DEV, O_WRONLY, 0); + int fd = open(DEVNULL, O_WRONLY, 0); /* * The closes might look redundant, but they are not: we want to be @@ -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); + } } /* diff --git a/src/include/c.h b/src/include/c.h index 5803a28bf30..aca767ce8a9 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.222.2.2 2009/03/11 00:08:07 alvherre Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.222.2.3 2010/04/01 20:12:34 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -762,7 +762,11 @@ typedef NameData *Name; #include #endif -/* These are for things that are one way on Unix and another on NT */ +/* + * This only works on Unix, not on Windows! This isn't used in PostgreSQL + * anymore, use the platform-aware DEVNULL instead. This is kept here just + * in case a 3rd party module uses it. + */ #define NULL_DEV "/dev/null" /*