Skip to content

Commit aef61bf

Browse files
committed
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.
1 parent 64e43c5 commit aef61bf

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/backend/postmaster/syslogger.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,18 @@ SysLoggerMain(int argc, char *argv[])
205205
* darn sure the pipe gets closed even if the open failed. We can
206206
* survive running with stderr pointing nowhere, but we can't afford
207207
* to have extra pipe input descriptors hanging around.
208+
*
209+
* As we're just trying to reset these to go to DEVNULL, there's not
210+
* much point in checking for failure from the close/dup2 calls here,
211+
* if they fail then presumably the file descriptors are closed and
212+
* any writes will go into the bitbucket anyway.
208213
*/
209214
close(fileno(stdout));
210215
close(fileno(stderr));
211216
if (fd != -1)
212217
{
213-
if (dup2(fd, fileno(stdout)) < 0)
214-
ereport(FATAL,
215-
(errcode_for_file_access(),
216-
errmsg("could not redirect stdout: %m")));
217-
if (dup2(fd, fileno(stderr)) < 0)
218-
ereport(FATAL,
219-
(errcode_for_file_access(),
220-
errmsg("could not redirect stderr: %m")));
218+
(void) dup2(fd, fileno(stdout));
219+
(void) dup2(fd, fileno(stderr));
221220
close(fd);
222221
}
223222
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy