Merge branch 'readonly_config'
[exim.git] / src / src / ip.c
index c09962a38933667e6ff10e04131a1e799f53dd20..96a6c29f20e5082d32833664fd6559b4e27eace0 100644 (file)
@@ -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;