Fixed last change which only still worked if the OS returned the IPv6 socket first and now failed completely if not.

This commit is contained in:
Mark Pizzolato 2013-01-23 15:12:35 -08:00
parent 2f4de5c4b1
commit e6eae9194f

View file

@ -721,7 +721,7 @@ if (preferred->ai_family == AF_INET6) {
sta = setsockopt (newsock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&off, sizeof(off)); sta = setsockopt (newsock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&off, sizeof(off));
} }
#endif #endif
sta = bind (newsock, result->ai_addr, result->ai_addrlen); sta = bind (newsock, preferred->ai_addr, preferred->ai_addrlen);
p_freeaddrinfo(result); p_freeaddrinfo(result);
if (sta == SOCKET_ERROR) /* bind error? */ if (sta == SOCKET_ERROR) /* bind error? */
return sim_err_sock (newsock, "bind", 1); return sim_err_sock (newsock, "bind", 1);