diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-10-23 12:40:07 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 12:40:07 +0300 |
| commit | be50cd1ee0a9c6b54bbd2bb93d710f8a39b6804c (patch) | |
| tree | b476f6108c5cec6f55ad07ac922b9d44277f4543 | |
| parent | 0401930508cfda069deaacf82dabf5e0ba8aed7c (diff) | |
| parent | cbeb51ca2cc2712f5eca63877e4d446263639515 (diff) | |
Merge pull request #17202 from FRRouting/mergify/bp/stable/10.1/pr-17198
Revert "lib: Attach stdout to child only if --log=stdout and stdout F… (backport #17198)
| -rw-r--r-- | lib/libfrr.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c index efb50fd041..cc60cfb829 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -1115,12 +1115,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); } } @@ -1206,12 +1203,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); } |
