X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fip.c;h=96a6c29f20e5082d32833664fd6559b4e27eace0;hb=5cd1d1356732d96d49a1f7c682d1b8a33b2576f9;hp=4c543566dd55b0547548d1c732dd2af03eb87cbc;hpb=c3da38a12a2372a7f6a48be97ebfd80aeceda828;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/ip.c b/src/src/ip.c index 4c543566d..96a6c29f2 100644 --- a/src/src/ip.c +++ b/src/src/ip.c @@ -3,6 +3,7 @@ *************************************************/ /* Copyright (c) University of Cambridge 1995 - 2018 */ +/* Copyright (c) The Exim Maintainers 2020 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions for doing things with sockets. With the advent of IPv6 this has @@ -126,8 +127,6 @@ if (af == AF_INET6) 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 "". */ @@ -208,8 +207,6 @@ if (af == AF_INET6) 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 @@ -466,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) { - if (fd != fd6) close(fd6); - if (fd != fd4) close(fd4); + if (fd6 >= 0 && fd != fd6) close(fd6); + if (fd4 >= 0 && fd != fd4) close(fd4); if (connhost) { h->port = port;