diff options
author | Azat Khuzhin <a3at.mail@gmail.com> | 2018-10-28 18:11:22 +0300 |
---|---|---|
committer | Azat Khuzhin <a3at.mail@gmail.com> | 2018-10-28 18:39:20 +0300 |
commit | 23e79fd764b9f36f560d470f0fb60295dd942ac2 (patch) | |
tree | 42f10a6da508b6ed94d08b3b9b0afd8aec91fc25 | |
parent | 931ec2370228e40309af51b86e10fa364a37a20e (diff) | |
download | libevent-23e79fd764b9f36f560d470f0fb60295dd942ac2.tar.gz |
Check existence of IPV6_V6ONLY in evutil_make_listen_socket_ipv6only() (mingw32)
MinGW 32-bit 5.3.0 does not defines it and our appveyour [1] build
reports this instantly:
evutil.c: In function 'evutil_make_listen_socket_ipv6only':
evutil.c:392:40: error: 'IPV6_V6ONLY' undeclared (first use in this function)
return setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*) &one,
[1]: https://www.appveyor.com/docs/windows-images-software/#mingw-msys-cygwin
Another solution will be to use mingw64 which has it, but I guess we do
want that #ifdef anyway.
-rw-r--r-- | evutil.c | 3 | ||||
-rw-r--r-- | include/event2/util.h | 3 |
2 files changed, 5 insertions, 1 deletions
@@ -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 c0f5f80b..80574c71 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); |