diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-10-23 09:19:07 +0300 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 09:19:07 +0300 | 
| commit | 00d741cc42512cf1d22ec773317dda4dc6e7397c (patch) | |
| tree | 43dbdc0939bc9beb41fcb84d63261cee2ea3bd98 /lib | |
| parent | 7ee4b2c99b9431052bb64674125a5d8399d416e6 (diff) | |
| parent | 9d5dc5dd8d58e5f7c271106951a63a104dfc2e70 (diff) | |
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)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libfrr.c | 14 | 
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c index 3187d8d4b6..33237df5fc 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -1108,12 +1108,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);  	}  } @@ -1199,12 +1196,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);  		}  | 
