Merge pull request #17201 from FRRouting/mergify/bp/dev/10.2/pr-17198

Revert "lib: Attach stdout to child only if --log=stdout and stdout F… (backport #17198)
This commit is contained in:
Donatas Abraitis 2024-10-23 09:18:44 +03:00 committed by GitHub
commit fceb618186
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1126,12 +1126,9 @@ static void frr_terminal_close(int isexit)
* don't redirect when stdout is set with --log stdout * don't redirect when stdout is set with --log stdout
*/ */
for (fd = 2; fd >= 0; fd--) for (fd = 2; fd >= 0; fd--)
if (logging_to_stdout && isatty(fd) && if (isatty(fd) &&
fd == STDOUT_FILENO) { (fd != STDOUT_FILENO || !logging_to_stdout))
/* Do nothing. */
} else {
dup2(nullfd, fd); dup2(nullfd, fd);
}
close(nullfd); close(nullfd);
} }
} }
@ -1217,12 +1214,9 @@ void frr_run(struct event_loop *master)
* stdout * stdout
*/ */
for (fd = 2; fd >= 0; fd--) for (fd = 2; fd >= 0; fd--)
if (logging_to_stdout && isatty(fd) && if (isatty(fd) &&
fd == STDOUT_FILENO) { (fd != STDOUT_FILENO || !logging_to_stdout))
/* Do nothing. */
} else {
dup2(nullfd, fd); dup2(nullfd, fd);
}
close(nullfd); close(nullfd);
} }