diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index 5f696b665..fff8e3e6e 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -332,12 +332,7 @@ ServerSocket::AddPortIPv6(unsigned port) noexcept static bool SupportsIPv6() noexcept { - int fd = socket(AF_INET6, SOCK_STREAM, 0); - if (fd < 0) - return false; - - close(fd); - return true; + return UniqueSocketDescriptor{}.Create(AF_INET6, SOCK_STREAM, 0); } #endif /* HAVE_IPV6 */