Skip to content
Snippets Groups Projects
Commit aef61bf4 authored by Stephen Frost's avatar Stephen Frost
Browse files

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.
parent 64e43c59
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment