]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: only close std{in,out,err} in daemon mode
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 13 Nov 2018 15:18:23 +0000 (16:18 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 13 Nov 2018 15:21:15 +0000 (16:21 +0100)
This allows to output messages when we are not in daemon mode which is
useful to use log stdout in master worker mode.

src/haproxy.c

index c71482224fb8d418f375bf96529c397c91fe18c9..494160ad8e5a7cf43200bcc223942c6e09be9481 100644 (file)
@@ -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;