Skip to content

Commit 00d741c

Browse files
authored
Merge pull request #17204 from FRRouting/mergify/bp/stable/9.1/pr-17198
Revert "lib: Attach stdout to child only if --log=stdout and stdout F… (backport #17198)
2 parents 7ee4b2c + 9d5dc5d commit 00d741c

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
@@ -1108,12 +1108,9 @@ static void frr_terminal_close(int isexit)
11081108
* don't redirect when stdout is set with --log stdout
11091109
*/
11101110
for (fd = 2; fd >= 0; fd--)
1111-
if (logging_to_stdout && isatty(fd) &&
1112-
fd == STDOUT_FILENO) {
1113-
/* Do nothing. */
1114-
} else {
1111+
if (isatty(fd) &&
1112+
(fd != STDOUT_FILENO || !logging_to_stdout))
11151113
dup2(nullfd, fd);
1116-
}
11171114
close(nullfd);
11181115
}
11191116
}
@@ -1199,12 +1196,9 @@ void frr_run(struct event_loop *master)
11991196
* stdout
12001197
*/
12011198
for (fd = 2; fd >= 0; fd--)
1202-
if (logging_to_stdout && isatty(fd) &&
1203-
fd == STDOUT_FILENO) {
1204-
/* Do nothing. */
1205-
} else {
1199+
if (isatty(fd) &&
1200+
(fd != STDOUT_FILENO || !logging_to_stdout))
12061201
dup2(nullfd, fd);
1207-
}
12081202
close(nullfd);
12091203
}
12101204

0 commit comments

Comments
 (0)