mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUG/MEDIUM: mworker: don't close stdio several time
This patch makes sure that a frontend socket that gets created after initialization won't be closed when the master gets re-executed. When used in daemon mode, the master-worker is closing the FDs 0, 1, 2 after the fork of the children. When the master was reloading, those FDs were assigned again during the parsing of the configuration (probably for some listeners), and the workers were closing them thinking it was the stdio. This patch must be backported to 1.8.
This commit is contained in:
parent
d790143d99
commit
149a81a443
@ -2580,9 +2580,18 @@ int main(int argc, char **argv)
|
||||
|
||||
/* MODE_QUIET can inhibit alerts and warnings below this line */
|
||||
|
||||
if ((global.mode & MODE_QUIET) && !(global.mode & MODE_VERBOSE)) {
|
||||
/* detach from the tty */
|
||||
fclose(stdin); fclose(stdout); fclose(stderr);
|
||||
if (getenv("HAPROXY_MWORKER_REEXEC") != NULL) {
|
||||
/* either stdin/out/err are already closed or should stay as they are. */
|
||||
if ((global.mode & MODE_DAEMON)) {
|
||||
/* daemon mode re-executing, stdin/stdout/stderr are already closed so keep quiet */
|
||||
global.mode &= ~MODE_VERBOSE;
|
||||
global.mode |= MODE_QUIET; /* ensure that we won't say anything from now */
|
||||
}
|
||||
} else {
|
||||
if ((global.mode & MODE_QUIET) && !(global.mode & MODE_VERBOSE)) {
|
||||
/* detach from the tty */
|
||||
fclose(stdin); fclose(stdout); fclose(stderr);
|
||||
}
|
||||
}
|
||||
|
||||
/* open log & pid files before the chroot */
|
||||
|
Loading…
Reference in New Issue
Block a user