X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/fdf57ede8c1cd60ee07f6f8eab5fbfac1224a431..dcd08dc51cb77e9ab796d1bdb5739436c90a6ad4:/socket.c diff --git a/socket.c b/socket.c index 549d40d4..29fb2dcd 100644 --- a/socket.c +++ b/socket.c @@ -369,8 +369,12 @@ static int *open_socket_in(int type, int port, const char *bind_address, #ifdef IPV6_V6ONLY if (resp->ai_family == AF_INET6) { - setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, - (char *)&one, sizeof one); + if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, + (char *)&one, sizeof one) < 0 + && default_af_hint != AF_INET6) { + close(s); + continue; + } } #endif