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.
This commit is contained in:
William Lallemand 2018-11-13 16:18:23 +01:00 committed by Willy Tarreau
parent 3aac1068f7
commit 2e8fad9c30

View 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;