diff --git a/evutil.c b/evutil.c index 5d385bdc75..402ab0d82e 100644 --- a/evutil.c +++ b/evutil.c @@ -388,9 +388,12 @@ evutil_make_listen_socket_reuseable_port(evutil_socket_t sock) int evutil_make_listen_socket_ipv6only(evutil_socket_t sock) { +#if defined(IPV6_V6ONLY) int one = 1; return setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*) &one, (ev_socklen_t)sizeof(one)); +#endif + return 0; } int diff --git a/include/event2/util.h b/include/event2/util.h index c0f5f80bef..80574c71e3 100644 --- a/include/event2/util.h +++ b/include/event2/util.h @@ -451,7 +451,8 @@ int evutil_make_socket_closeonexec(evutil_socket_t sock); socket() or accept(). @param sock The socket to be closed - @return 0 on success, -1 on failure + @return 0 on success (whether the operation is supported or not), + -1 on failure */ EVENT2_EXPORT_SYMBOL int evutil_closesocket(evutil_socket_t sock);