diff options
| author | Russ White <russ@riw.us> | 2024-10-22 16:35:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-22 16:35:05 -0400 |
| commit | a4ecc2f4d23d66f62a85671e04da924c3e7a92c0 (patch) | |
| tree | 24ec9d4b3ac577f07f9b09438a4934adf2b9c4c7 | |
| parent | 8ccd53884707b6efabdb8c8fed4a4738b3b2c1b1 (diff) | |
| parent | 6a36b9ef49bfce59a7e674df233265da6d275257 (diff) | |
Merge pull request #17198 from donaldsharp/backout_stdout_changes
Revert "lib: Attach stdout to child only if --log=stdout and stdout F…
| -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 f2247a48e5..313fe99fd3 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); } |
