git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Linux and the BSDs have getifaddrs(). Use it and save a bunch of complex coding.
[exim.git]
/
src
/
src
/
ip.c
diff --git
a/src/src/ip.c
b/src/src/ip.c
index a5958e95e43098556d6c7c7d94ef84756616ae45..96a6c29f20e5082d32833664fd6559b4e27eace0 100644
(file)
--- a/
src/src/ip.c
+++ b/
src/src/ip.c
@@
-127,8
+127,6
@@
if (af == AF_INET6)
return sizeof(sin->v6);
}
else
return sizeof(sin->v6);
}
else
-#else /* HAVE_IPv6 */
-af = af; /* Avoid compiler warning */
#endif /* HAVE_IPV6 */
/* Setup code when using IPv4 socket. The wildcard address is "". */
#endif /* HAVE_IPV6 */
/* Setup code when using IPv4 socket. The wildcard address is "". */
@@
-209,8
+207,6
@@
if (af == AF_INET6)
s_len = sizeof(s_in6);
}
else
s_len = sizeof(s_in6);
}
else
-#else /* HAVE_IPV6 */
-af = af; /* Avoid compiler warning */
#endif /* HAVE_IPV6 */
/* For an IPv4 address, use an IPv4 sockaddr structure, even on a system with
#endif /* HAVE_IPV6 */
/* For an IPv4 address, use an IPv4 sockaddr structure, even on a system with
@@
-467,8
+463,8
@@
for (host_item * h = &shost; h; h = h->next)
for (int port = portlo; port <= porthi; port++)
if (ip_connect(fd, af, h->address, port, timeout, fastopen_blob) == 0)
{
for (int port = portlo; port <= porthi; port++)
if (ip_connect(fd, af, h->address, port, timeout, fastopen_blob) == 0)
{
- if (fd != fd6) close(fd6);
- if (fd != fd4) close(fd4);
+ if (fd
6 >= 0 && fd
!= fd6) close(fd6);
+ if (fd
4 >= 0 && fd
!= fd4) close(fd4);
if (connhost)
{
h->port = port;
if (connhost)
{
h->port = port;