[exim-cvs] Avoid needless socket close

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] Avoid needless socket close
Gitweb: https://git.exim.org/exim.git/commitdiff/3bd31c400d7cb546c5583fbee8d998e232eef5c2
Commit:     3bd31c400d7cb546c5583fbee8d998e232eef5c2
Parent:     62a4137ec452ff0a6801923930b003e954ec09aa
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Fri Jan 1 12:09:37 2021 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri Jan 1 12:09:37 2021 +0000


    Avoid needless socket close
---
 src/src/ip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


diff --git a/src/src/ip.c b/src/src/ip.c
index c09962a..96a6c29 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;