BUG/MINOR: tcp: avoid closing fd when socket failed in tcp_bind_listener

we were trying to close file descriptor even when `socket` call was
failing.
this should fix github issue #499

this should be backported to all versions >= v1.8

Fixes: 153659f1ae69a1 ("MINOR: tcp: When binding socket, attempt to
reuse one from the old proc.")
Signed-off-by: William Dauchy <w.dauchy@criteo.com>
(cherry picked from commit c0e23aef051dd3916ef3eedf934837942cb7db71)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 938977daf597667c589cfdf1a87bb00ba2bcfdad)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index c6f70d2..8bdaf93 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -832,8 +832,8 @@
 			if (getsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &default_tcp_maxseg,
 			    &ready_len) == -1)
 				ha_warning("Failed to get the default value of TCP_MAXSEG\n");
+			close(fd);
 		}
-		close(fd);
 	}
 	if (default_tcp6_maxseg == -1) {
 		default_tcp6_maxseg = -2;