From 7a5f485cf8a55faf72b64ec2b6c2a6f3130926a1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Mar 2023 10:04:52 +0200 Subject: [PATCH] event/ServerSocket: use class UniqueSocketDescriptor in SupportsIPv6() --- src/event/ServerSocket.cxx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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 */