BUG/MEDIUM: mworker: increase maxsock with each new worker

In ticket #2184, HAProxy is crashing in a BUG_ON() after a lot of reload
when the previous processes did not exit.

Each worker has a socketpair which is a FD in the master, when reloading
this FD still exists until the process leaves. But the global.maxconn
value is not incremented for each of these FD. So when there is too much
workers and the number of FD reaches maxsock, the next FD inserted in
the poller will crash the process.

This patch fixes the issue by increasing the maxsock for each remaining
worker.

Must be backported in every maintained version.

(cherry picked from commit e6051a04efc0616cc84256cad5ef9b264818daef)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
(cherry picked from commit 67bddbf79027f7bc130c05add91720bd3cbc8f54)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
(cherry picked from commit 665275e97a1ac6ec6c5a7eb61deddb7695b935a3)
[wla: cfd= does not exist in 2.6]
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
(cherry picked from commit 33ea988c553ecb001e44f8897191ee0d02daab17)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/mworker.c b/src/mworker.c
index 7fd0631..6415fd4 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -181,6 +181,8 @@
 
 			} else if (strncmp(subtoken, "fd=", 3) == 0) {
 				child->ipc_fd[0] = atoi(subtoken+3);
+				if (child->ipc_fd[0] > -1)
+					global.maxsock++;
 			} else if (strncmp(subtoken, "pid=", 4) == 0) {
 				child->pid = atoi(subtoken+4);
 			} else if (strncmp(subtoken, "rpid=", 5) == 0) {