getlistenfd: on setsockopt failure it could return an invalid/closed fd - geomyidae - A small C-based gopherd.
(HTM) git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit cb9b6b70dbc6b33cc29364ba31023ffeb0579085
(DIR) parent feed37adc1b23cac513b5d2a17bda4e2ffc77c81
(HTM) 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:
M main.c | 1 +
1 file changed, 1 insertion(+), 0 deletions(-)
---
(DIR) 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;
}