You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.5 KiB

  1. --- a/src/sock.c
  2. +++ b/src/sock.c
  3. @@ -39,8 +39,7 @@
  4. * returned if the bind succeeded. Otherwise, -1 is returned
  5. * to indicate an error.
  6. */
  7. -static int
  8. -bind_socket (int sockfd, const char *addr, int family)
  9. +static int bind_socket (int sockfd, const char *addr)
  10. {
  11. struct addrinfo hints, *res, *ressave;
  12. @@ -48,7 +47,7 @@ bind_socket (int sockfd, const char *add
  13. assert (addr != NULL && strlen (addr) != 0);
  14. memset (&hints, 0, sizeof (struct addrinfo));
  15. - hints.ai_family = family;
  16. + hints.ai_family = AF_UNSPEC;
  17. hints.ai_socktype = SOCK_STREAM;
  18. /* The local port it not important */
  19. @@ -112,14 +111,12 @@ int opensock (const char *host, int port
  20. /* Bind to the specified address */
  21. if (bind_to) {
  22. - if (bind_socket (sockfd, bind_to,
  23. - res->ai_family) < 0) {
  24. + if (bind_socket (sockfd, bind_to) < 0) {
  25. close (sockfd);
  26. continue; /* can't bind, so try again */
  27. }
  28. } else if (config.bind_address) {
  29. - if (bind_socket (sockfd, config.bind_address,
  30. - res->ai_family) < 0) {
  31. + if (bind_socket (sockfd, config.bind_address) < 0) {
  32. close (sockfd);
  33. continue; /* can't bind, so try again */
  34. }