aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Frost <sfrost@snowman.net>2014-01-28 08:40:41 -0500
committerStephen Frost <sfrost@snowman.net>2014-01-28 08:40:41 -0500
commitaef61bf433a9e9b6e2d98b0fdcce8562c3ad526f (patch)
tree8dfcfd95433f6c5aa4240a67b7d229a0e9b18721 /src
parent64e43c59b817a78ddf70f2fd62de31a4add5d988 (diff)
downloadpostgresql-aef61bf433a9e9b6e2d98b0fdcce8562c3ad526f.tar.gz
postgresql-aef61bf433a9e9b6e2d98b0fdcce8562c3ad526f.zip
Revert dup2() checking in syslogger.c
Per the expanded comment- As we're just trying to reset these to go to DEVNULL, there's not much point in checking for failure from the close/dup2 calls here, if they fail then presumably the file descriptors are closed and any writes will go into the bitbucket anyway. Pointed out by Tom.
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/syslogger.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index 3c54956e70f..e277a9a8a66 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -205,19 +205,18 @@ SysLoggerMain(int argc, char *argv[])
* darn sure the pipe gets closed even if the open failed. We can
* survive running with stderr pointing nowhere, but we can't afford
* to have extra pipe input descriptors hanging around.
+ *
+ * As we're just trying to reset these to go to DEVNULL, there's not
+ * much point in checking for failure from the close/dup2 calls here,
+ * if they fail then presumably the file descriptors are closed and
+ * any writes will go into the bitbucket anyway.
*/
close(fileno(stdout));
close(fileno(stderr));
if (fd != -1)
{
- if (dup2(fd, fileno(stdout)) < 0)
- ereport(FATAL,
- (errcode_for_file_access(),
- errmsg("could not redirect stdout: %m")));
- if (dup2(fd, fileno(stderr)) < 0)
- ereport(FATAL,
- (errcode_for_file_access(),
- errmsg("could not redirect stderr: %m")));
+ (void) dup2(fd, fileno(stdout));
+ (void) dup2(fd, fileno(stderr));
close(fd);
}
}