Skip to content

Commit 3718a7a

Browse files
authored
Merge pull request #17203 from FRRouting/mergify/bp/stable/10.0/pr-17198
Revert "lib: Attach stdout to child only if --log=stdout and stdout F… (backport #17198)
2 parents 1476d58 + b18613b commit 3718a7a

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
@@ -1110,12 +1110,9 @@ static void frr_terminal_close(int isexit)
11101110
* don't redirect when stdout is set with --log stdout
11111111
*/
11121112
for (fd = 2; fd >= 0; fd--)
1113-
if (logging_to_stdout && isatty(fd) &&
1114-
fd == STDOUT_FILENO) {
1115-
/* Do nothing. */
1116-
} else {
1113+
if (isatty(fd) &&
1114+
(fd != STDOUT_FILENO || !logging_to_stdout))
11171115
dup2(nullfd, fd);
1118-
}
11191116
close(nullfd);
11201117
}
11211118
}
@@ -1201,12 +1198,9 @@ void frr_run(struct event_loop *master)
12011198
* stdout
12021199
*/
12031200
for (fd = 2; fd >= 0; fd--)
1204-
if (logging_to_stdout && isatty(fd) &&
1205-
fd == STDOUT_FILENO) {
1206-
/* Do nothing. */
1207-
} else {
1201+
if (isatty(fd) &&
1202+
(fd != STDOUT_FILENO || !logging_to_stdout))
12081203
dup2(nullfd, fd);
1209-
}
12101204
close(nullfd);
12111205
}
12121206

0 commit comments

Comments
 (0)