commit cb9b6b70dbc6b33cc29364ba31023ffeb0579085
parent feed37adc1b23cac513b5d2a17bda4e2ffc77c81
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 29 Aug 2018 20:18:50 +0200
getlistenfd: on setsockopt failure it could return an invalid/closed fd
Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/main.c b/main.c
@@ -311,6 +311,7 @@ getlistenfd(struct addrinfo *hints, char *bindip, char *port)
if (setsockopt(listfd, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) < 0) {
close(listfd);
+ listfd = -1;
break;
}