From: William Lallemand Date: Tue, 13 Nov 2018 15:18:23 +0000 (+0100) Subject: MINOR: mworker: only close std{in,out,err} in daemon mode X-Git-Tag: v1.9-dev7~126 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e8fad9c3042a2bb48a4409e12c73a86a5f53a37;p=thirdparty%2Fhaproxy.git MINOR: mworker: only close std{in,out,err} in daemon mode This allows to output messages when we are not in daemon mode which is useful to use log stdout in master worker mode. --- diff --git a/src/haproxy.c b/src/haproxy.c index c71482224f..494160ad8e 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -3201,12 +3201,16 @@ int main(int argc, char **argv) curpeers->peers_fe = NULL; } - /* if we're NOT in QUIET mode, we should now close the 3 first FDs to ensure - * that we can detach from the TTY. We MUST NOT do it in other cases since - * it would have already be done, and 0-2 would have been affected to listening - * sockets + /* + * This is only done in daemon mode because we might want the + * logs on stdout in mworker mode. If we're NOT in QUIET mode, + * we should now close the 3 first FDs to ensure that we can + * detach from the TTY. We MUST NOT do it in other cases since + * it would have already be done, and 0-2 would have been + * affected to listening sockets */ - if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) { + if ((global.mode & MODE_DAEMON) && + (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE))) { /* detach from the tty */ stdio_quiet(devnullfd); global.mode &= ~MODE_VERBOSE;