mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
MINOR: init: Use devnullfd in stdio_quiet calls instead of recreating a fd everytime
Since commit "65760d MINOR: init: Make devnullfd global and create it earlier in init" the devnullfd file descriptor pointing to /dev/null is created regardless of the process's parameters so we can use it in all 'stdio_quiet' calls instead or recreating an FD.
This commit is contained in:
parent
1ec59d3426
commit
a011683622
@ -2659,7 +2659,7 @@ static int _send_status(char **args, char *payload, struct appctx *appctx, void
|
||||
(global.mode & MODE_DAEMON)) {
|
||||
/* detach from the tty, this is required to properly daemonize. */
|
||||
if ((getenv("HAPROXY_MWORKER_REEXEC") == NULL))
|
||||
stdio_quiet(-1);
|
||||
stdio_quiet(devnullfd);
|
||||
global.mode &= ~MODE_VERBOSE;
|
||||
global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
|
||||
}
|
||||
|
||||
@ -2496,7 +2496,7 @@ static void step_init_4(void)
|
||||
} else {
|
||||
if ((global.mode & MODE_QUIET) && !(global.mode & MODE_VERBOSE)) {
|
||||
/* detach from the tty */
|
||||
stdio_quiet(-1);
|
||||
stdio_quiet(devnullfd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2596,7 +2596,7 @@ static void run_master_in_recovery_mode(int argc, char **argv)
|
||||
(global.mode & MODE_DAEMON)) {
|
||||
/* detach from the tty, this is required to properly daemonize. */
|
||||
if ((getenv("HAPROXY_MWORKER_REEXEC") == NULL))
|
||||
stdio_quiet(-1);
|
||||
stdio_quiet(devnullfd);
|
||||
global.mode &= ~MODE_VERBOSE;
|
||||
global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
|
||||
}
|
||||
@ -3551,9 +3551,9 @@ int main(int argc, char **argv)
|
||||
stdio_quiet(devnullfd);
|
||||
global.mode &= ~MODE_VERBOSE;
|
||||
global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
|
||||
close(devnullfd);
|
||||
devnullfd = -1;
|
||||
}
|
||||
close(devnullfd);
|
||||
devnullfd = -1;
|
||||
pid = getpid(); /* update pid */
|
||||
|
||||
/* This call is expensive, as it creates a new poller, scans and tries
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user