From: Jeremy Harris Date: Fri, 1 Jan 2021 12:09:37 +0000 (+0000) Subject: Avoid needless socket close X-Git-Tag: exim-4.95-RC0~170 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/3bd31c400d7cb546c5583fbee8d998e232eef5c2 Avoid needless socket close --- diff --git a/src/src/ip.c b/src/src/ip.c index c09962a38..96a6c29f2 100644 --- a/src/src/ip.c +++ b/src/src/ip.c @@ -463,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;