]> git.puffer.fish Git - mirror/frr.git/commitdiff
Revert "lib: Attach stdout to child only if --log=stdout and stdout FD is a tty" 17202/head
authorDonald Sharp <sharpd@nvidia.com>
Tue, 22 Oct 2024 15:13:07 +0000 (11:13 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 22 Oct 2024 20:37:05 +0000 (20:37 +0000)
This reverts commit 0e3c5e8e5907321b35201f0985c1d3f4a1b0e639.

(cherry picked from commit 6a36b9ef49bfce59a7e674df233265da6d275257)

lib/libfrr.c

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