mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
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.
This commit is contained in:
parent
64e43c59b8
commit
aef61bf433
@ -205,19 +205,18 @@ SysLoggerMain(int argc, char *argv[])
|
|||||||
* darn sure the pipe gets closed even if the open failed. We can
|
* darn sure the pipe gets closed even if the open failed. We can
|
||||||
* survive running with stderr pointing nowhere, but we can't afford
|
* survive running with stderr pointing nowhere, but we can't afford
|
||||||
* to have extra pipe input descriptors hanging around.
|
* 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(stdout));
|
||||||
close(fileno(stderr));
|
close(fileno(stderr));
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
if (dup2(fd, fileno(stdout)) < 0)
|
(void) dup2(fd, fileno(stdout));
|
||||||
ereport(FATAL,
|
(void) dup2(fd, fileno(stderr));
|
||||||
(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")));
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user