event/ServerSocket: use class UniqueSocketDescriptor in SupportsIPv6()

This commit is contained in:
Max Kellermann 2023-03-29 10:04:52 +02:00
parent 90565b1e36
commit 7a5f485cf8

View File

@ -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 */