MEDIUM: init: don't stop proxies in parent process when exiting
That's pointless, and that's confusing when debugging.
(cherry picked from commit edaff0a8f5bc001c9ddedf09a2b47746e3333138)
diff --git a/src/haproxy.c b/src/haproxy.c
index eac6f44..9a76d1b 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -1588,6 +1588,15 @@
free(global.chroot); global.chroot = NULL;
free(global.pidfile); global.pidfile = NULL;
+ if (proc == global.nbproc) {
+ if (global.mode & MODE_SYSTEMD) {
+ protocol_unbind_all();
+ for (proc = 0; proc < global.nbproc; proc++)
+ while (waitpid(children[proc], NULL, 0) == -1 && errno == EINTR);
+ }
+ exit(0); /* parent must leave */
+ }
+
/* we might have to unbind some proxies from some processes */
px = proxy;
while (px != NULL) {
@@ -1598,15 +1607,6 @@
px = px->next;
}
- if (proc == global.nbproc) {
- if (global.mode & MODE_SYSTEMD) {
- protocol_unbind_all();
- for (proc = 0; proc < global.nbproc; proc++)
- while (waitpid(children[proc], NULL, 0) == -1 && errno == EINTR);
- }
- exit(0); /* parent must leave */
- }
-
free(children);
children = NULL;
/* if we're NOT in QUIET mode, we should now close the 3 first FDs to ensure