Skip to content

Commit be50cd1

Browse files
authored
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)
2 parents 0401930 + cbeb51c commit be50cd1

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
@@ -1115,12 +1115,9 @@ static void frr_terminal_close(int isexit)
11151115
* don't redirect when stdout is set with --log stdout
11161116
*/
11171117
for (fd = 2; fd >= 0; fd--)
1118-
if (logging_to_stdout && isatty(fd) &&
1119-
fd == STDOUT_FILENO) {
1120-
/* Do nothing. */
1121-
} else {
1118+
if (isatty(fd) &&
1119+
(fd != STDOUT_FILENO || !logging_to_stdout))
11221120
dup2(nullfd, fd);
1123-
}
11241121
close(nullfd);
11251122
}
11261123
}
@@ -1206,12 +1203,9 @@ void frr_run(struct event_loop *master)
12061203
* stdout
12071204
*/
12081205
for (fd = 2; fd >= 0; fd--)
1209-
if (logging_to_stdout && isatty(fd) &&
1210-
fd == STDOUT_FILENO) {
1211-
/* Do nothing. */
1212-
} else {
1206+
if (isatty(fd) &&
1207+
(fd != STDOUT_FILENO || !logging_to_stdout))
12131208
dup2(nullfd, fd);
1214-
}
12151209
close(nullfd);
12161210
}
12171211

0 commit comments

Comments
 (0)