1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-13 05:03:45 -04:00

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.
This commit is contained in:
Will Storey 2019-02-18 10:52:06 -08:00
parent e793d7af9f
commit 2db359fbb3

View File

@ -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);