Skip to content

Commit fceb618

Browse files
authored
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)
2 parents c471385 + 77e0dc9 commit fceb618

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/libfrr.c

+4-10
Original file line numberDiff line numberDiff line change
@@ -1126,12 +1126,9 @@ static void frr_terminal_close(int isexit)
11261126
* don't redirect when stdout is set with --log stdout
11271127
*/
11281128
for (fd = 2; fd >= 0; fd--)
1129-
if (logging_to_stdout && isatty(fd) &&
1130-
fd == STDOUT_FILENO) {
1131-
/* Do nothing. */
1132-
} else {
1129+
if (isatty(fd) &&
1130+
(fd != STDOUT_FILENO || !logging_to_stdout))
11331131
dup2(nullfd, fd);
1134-
}
11351132
close(nullfd);
11361133
}
11371134
}
@@ -1217,12 +1214,9 @@ void frr_run(struct event_loop *master)
12171214
* stdout
12181215
*/
12191216
for (fd = 2; fd >= 0; fd--)
1220-
if (logging_to_stdout && isatty(fd) &&
1221-
fd == STDOUT_FILENO) {
1222-
/* Do nothing. */
1223-
} else {
1217+
if (isatty(fd) &&
1218+
(fd != STDOUT_FILENO || !logging_to_stdout))
12241219
dup2(nullfd, fd);
1225-
}
12261220
close(nullfd);
12271221
}
12281222

0 commit comments

Comments
 (0)