--- src/sock.c +++ src/sock.c @@ -40,7 +40,7 @@ * to indicate an error. */ static int -bind_socket (int sockfd, const char *addr, int family) +bind_socket (int sockfd, const char *addr) { struct addrinfo hints, *res, *ressave; @@ -48,7 +48,7 @@ assert (addr != NULL && strlen (addr) != 0); memset (&hints, 0, sizeof (struct addrinfo)); - hints.ai_family = family; + hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; /* The local port it not important */ @@ -106,14 +106,12 @@ /* Bind to the specified address */ if (bind_to) { - if (bind_socket (sockfd, bind_to, - res->ai_family) < 0) { + if (bind_socket (sockfd, bind_to) < 0) { close (sockfd); continue; /* can't bind, so try again */ } } else if (config.bind_address) { - if (bind_socket (sockfd, config.bind_address, - res->ai_family) < 0) { + if (bind_socket (sockfd, config.bind_address) < 0) { close (sockfd); continue; /* can't bind, so try again */ }