summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-10-22 17:13:07 +0200
committerDonald Sharp <sharpd@nvidia.com>2024-10-22 17:13:07 +0200
commit6a36b9ef49bfce59a7e674df233265da6d275257 (patch)
treec34f83c37078bd56649cc3fd2704730191368b98 /lib
parentMerge pull request #17174 from baozhen-H3C/202410180225 (diff)
downloadfrr-6a36b9ef49bfce59a7e674df233265da6d275257.tar.xz
frr-6a36b9ef49bfce59a7e674df233265da6d275257.zip
Revert "lib: Attach stdout to child only if --log=stdout and stdout FD is a tty"
This reverts commit 0e3c5e8e5907321b35201f0985c1d3f4a1b0e639.
Diffstat (limited to 'lib')
-rw-r--r--lib/libfrr.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c
index f2247a48e..313fe99fd 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -1126,12 +1126,9 @@ static void frr_terminal_close(int isexit)
* don't redirect when stdout is set with --log stdout
*/
for (fd = 2; fd >= 0; fd--)
- if (logging_to_stdout && isatty(fd) &&
- fd == STDOUT_FILENO) {
- /* Do nothing. */
- } else {
+ if (isatty(fd) &&
+ (fd != STDOUT_FILENO || !logging_to_stdout))
dup2(nullfd, fd);
- }
close(nullfd);
}
}
@@ -1217,12 +1214,9 @@ void frr_run(struct event_loop *master)
* stdout
*/
for (fd = 2; fd >= 0; fd--)
- if (logging_to_stdout && isatty(fd) &&
- fd == STDOUT_FILENO) {
- /* Do nothing. */
- } else {
+ if (isatty(fd) &&
+ (fd != STDOUT_FILENO || !logging_to_stdout))
dup2(nullfd, fd);
- }
close(nullfd);
}