From 2db359fbb35b93f079ee695251421efc87951a40 Mon Sep 17 00:00:00 2001 From: Will Storey Date: Mon, 18 Feb 2019 10:52:06 -0800 Subject: [PATCH] Recognise non-zero as error rather than only -1 The error flag can be something other than -1 in the event of an error. Not checking for this could lead to us to try connecting to an unknown IP. --- src/core/net-nonblock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index 40e14605..64ff9c0f 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -197,8 +197,7 @@ static void simple_readpipe(SIMPLE_THREAD_REC *rec, GIOChannel *pipe) g_io_channel_unref(rec->pipes[1]); ip = iprec.ip4.family != 0 ? &iprec.ip4 : &iprec.ip6; - handle = iprec.error == -1 ? NULL : - net_connect_ip(ip, rec->port, rec->my_ip); + handle = iprec.error ? NULL : net_connect_ip(ip, rec->port, rec->my_ip); g_free_not_null(rec->my_ip);