From: Guus Sliepen Date: Mon, 1 Feb 2021 13:07:54 +0000 (+0100) Subject: Fix a socket fd leak. X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=9ced7621b5f25944dd756d45d5575fc87b27e507 Fix a socket fd leak. Due to a logic error, whenever an interface went down and up, one or more socket fds could be leaked. A long running process on a roaming device or an unstable network could therefore run out of fds. --- diff --git a/src/net.c b/src/net.c index 8bec6b67..ce999cba 100644 --- a/src/net.c +++ b/src/net.c @@ -700,7 +700,7 @@ void retry(meshlink_handle_t *mesh) { int sock = socket(sa.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); - if(sock != -1) { + if(sock == -1) { continue; }