Try all addresses returned by getaddrinfo() until we find one that socket() is happy with

Someone reported being unable to connect with the error "Address family not
supported", which is probably being returned by socket().  It is likely a
system where getaddrinfo() is returning AF_INET6 addresses, but socket()
won't create AF_INET6 sockets.

To handle this case, we loop over all the addresses returned by getaddrinfo()
until we find one that socket() will accept.
This commit is contained in:
Kevin Easton
2016-03-08 23:53:16 +11:00
parent c2a2d68d8d
commit 9427b3db84
2 changed files with 40 additions and 29 deletions

View File

@@ -1,5 +1,8 @@
[Changes 1.2.2]
* If we can't create a socket for the first address returned by getaddrinfo(),
try the other returned addresses. (caf)
* Only show version once with -v option (reported by cpet). (caf)
* Drop group privileges before droppping user privileges when execing. (caf)