Skip to content

Commit 56894db

Browse files
einval22wlallemand
authored andcommitted
MINOR: startup: keep updating verbosity modes only in haproxy.c
This commit prepares the move of mworker_run_master() in mworker.c. Let's remove from it's definition the code, which adjusts verbosity in dependency of other global run time modes (daemon or foreground). This part should stay in main(), where all verbosity modes are handeled for different mode combinations.
1 parent 7974089 commit 56894db

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/haproxy.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,14 +1964,6 @@ static void mworker_run_master()
19641964
{
19651965
struct mworker_proc *child, *it;
19661966

1967-
if ((!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
1968-
(global.mode & MODE_DAEMON)) {
1969-
/* detach from the tty, this is required to properly daemonize. */
1970-
if ((getenv("HAPROXY_MWORKER_REEXEC") == NULL))
1971-
stdio_quiet(-1);
1972-
global.mode &= ~MODE_VERBOSE;
1973-
global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
1974-
}
19751967
proc_self->failedreloads = 0; /* reset the number of failure */
19761968
mworker_loop();
19771969
#if defined(USE_OPENSSL) && !defined(OPENSSL_NO_DH)
@@ -3013,6 +3005,17 @@ static void run_master_in_recovery_mode(int argc, char **argv)
30133005
}
30143006

30153007
step_init_4();
3008+
3009+
/* set quiet mode if MODE_DAEMON */
3010+
if ((!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
3011+
(global.mode & MODE_DAEMON)) {
3012+
/* detach from the tty, this is required to properly daemonize. */
3013+
if ((getenv("HAPROXY_MWORKER_REEXEC") == NULL))
3014+
stdio_quiet(-1);
3015+
global.mode &= ~MODE_VERBOSE;
3016+
global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
3017+
}
3018+
30163019
/* enter in master polling loop */
30173020
mworker_run_master();
30183021
}
@@ -3846,6 +3849,15 @@ int main(int argc, char **argv)
38463849

38473850
/* Master enters in its polling loop */
38483851
if (master) {
3852+
/* set quiet mode if MODE_DAEMON */
3853+
if ((!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
3854+
(global.mode & MODE_DAEMON)) {
3855+
/* detach from the tty, this is required to properly daemonize. */
3856+
if ((getenv("HAPROXY_MWORKER_REEXEC") == NULL))
3857+
stdio_quiet(-1);
3858+
global.mode &= ~MODE_VERBOSE;
3859+
global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
3860+
}
38493861
mworker_run_master();
38503862
/* never get there in master context */
38513863
}

0 commit comments

Comments
 (0)