(mini_identd_addrinfo) Use closesocket() to close sockets
Also, set closed sockets to INVALID_SOCKET so that they won't be closed again.
This commit is contained in:

committed by
Love Hornquist Astrand

parent
867a1533be
commit
483da4ae9b
@@ -88,12 +88,14 @@ mini_inetd_addrinfo (struct addrinfo *ai)
|
|||||||
socket_set_ipv6only(fds[i], 1);
|
socket_set_ipv6only(fds[i], 1);
|
||||||
if (bind (fds[i], a->ai_addr, a->ai_addrlen) < 0) {
|
if (bind (fds[i], a->ai_addr, a->ai_addrlen) < 0) {
|
||||||
warn ("bind af = %d", a->ai_family);
|
warn ("bind af = %d", a->ai_family);
|
||||||
close(fds[i]);
|
closesocket(fds[i]);
|
||||||
|
fds[i] = INVALID_SOCKET;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (listen (fds[i], SOMAXCONN) < 0) {
|
if (listen (fds[i], SOMAXCONN) < 0) {
|
||||||
warn ("listen af = %d", a->ai_family);
|
warn ("listen af = %d", a->ai_family);
|
||||||
closesocket(fds[i]);
|
closesocket(fds[i]);
|
||||||
|
fds[i] = INVALID_SOCKET;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifndef NO_LIMIT_FD_SETSIZE
|
#ifndef NO_LIMIT_FD_SETSIZE
|
||||||
|
Reference in New Issue
Block a user