summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/http_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/server/h2o/http_server.c')
-rw-r--r--web/server/h2o/http_server.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/web/server/h2o/http_server.c b/web/server/h2o/http_server.c
index b94a7daeb..650a36184 100644
--- a/web/server/h2o/http_server.c
+++ b/web/server/h2o/http_server.c
@@ -46,6 +46,8 @@ static int create_listener(const char *ip, int port)
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1 ||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr_flag, sizeof(reuseaddr_flag)) != 0 ||
bind(fd, (struct sockaddr *)&addr, sizeof(addr)) != 0 || listen(fd, SOMAXCONN) != 0) {
+ if (fd != -1)
+ close(fd);
return -1;
}