MEDIUM: proxy: zombify proxies only when the expose-fd socket is bound

When HAProxy is running with multiple processes and some listeners
arebound to processes, the unused sockets were not closed in the other
processes. The aim was to be able to send those listening sockets using
the -x option.

However to ensure the previous behavior which was to close those
sockets, we provided the "no-unused-socket" global option.

This patch changes this behavior, it will close unused sockets which are
not in the same process as an expose-fd socket, making the
"no-unused-socket" option useless.

The "no-unused-socket" option was removed in this patch.
diff --git a/src/haproxy.c b/src/haproxy.c
index 261b213..5ccebd1 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -859,7 +859,6 @@
 #if defined(SO_REUSEPORT)
 	global.tune.options |= GTUNE_USE_REUSEPORT;
 #endif
-	global.tune.options |= GTUNE_SOCKET_TRANSFER;
 
 	pid = getpid();
 	progname = *argv;
@@ -2165,6 +2164,24 @@
 			exit(0); /* parent must leave */
 		}
 
+		/* pass through every cli socket, and check if it's bound to
+		 * the current process and if it exposes listeners sockets.
+		 * Caution: the GTUNE_SOCKET_TRANSFER is now set after the fork.
+		 * */
+
+		if (global.stats_fe) {
+			struct bind_conf *bind_conf;
+
+			list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
+				if (bind_conf->level & ACCESS_FD_LISTENERS) {
+					if (!bind_conf->bind_proc || bind_conf->bind_proc & (1UL << proc)) {
+						global.tune.options |= GTUNE_SOCKET_TRANSFER;
+						break;
+					}
+				}
+			}
+		}
+
 		/* we might have to unbind some proxies from some processes */
 		px = proxy;
 		while (px != NULL) {