diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2021-01-01 12:09:37 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2021-01-01 12:09:37 +0000 |
commit | 3bd31c400d7cb546c5583fbee8d998e232eef5c2 (patch) | |
tree | 2c745604568919210b5a868eed49d21c51682561 | |
parent | 62a4137ec452ff0a6801923930b003e954ec09aa (diff) |
Avoid needless socket close
-rw-r--r-- | src/src/ip.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |