MINOR: sock: move the unused socket cleaning code into its own function

The startup code used to scan the list of unused sockets retrieved from
an older process, and to close them one by one. This also required that
the knowledge of the internal storage of these temporary sockets was
known from outside sock.c and that the code was copy-pasted at every
call place.

This patch moves this into sock.c under the name
sock_drop_unused_old_sockets(), and removes the xfer_sock_list
definition from sock.h since the rest of the code doesn't need to know
this.

This cleanup is minimal and preliminary to a future fix that will need
to be backported to all versions featuring FD transfers over the CLI.

(cherry picked from commit b510116fd2b9a676297a1d2bec7d0107bf3c7383)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
(cherry picked from commit 9575192a04144ba2590767ea7281d36ef30a4fdf)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/haproxy.c b/src/haproxy.c
index ef5021a..a649d6a 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -3029,14 +3029,7 @@
 	/* Ok, all listeners should now be bound, close any leftover sockets
 	 * the previous process gave us, we don't need them anymore
 	 */
-	while (xfer_sock_list != NULL) {
-		struct xfer_sock_list *tmpxfer = xfer_sock_list->next;
-		close(xfer_sock_list->fd);
-		free(xfer_sock_list->iface);
-		free(xfer_sock_list->namespace);
-		free(xfer_sock_list);
-		xfer_sock_list = tmpxfer;
-	}
+	sock_drop_unused_old_sockets();
 
 	/* prepare pause/play signals */
 	signal_register_fct(SIGTTOU, sig_pause, SIGTTOU);