From 346808789cfd3556b8caf263bdd81982d6081296 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 5 Dec 2000 19:43:12 +0000 Subject: net_gethostbyname_nonblock(): don't crash if net_gethosterror() returns error message as NULL. Initialize winsock with win32. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@966 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/net-nonblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/net-nonblock.c') diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index e1d99fd8..73260381 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -103,11 +103,11 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe) errorstr = NULL; } else { errorstr = net_gethosterror(rec.error); - rec.errlen = strlen(errorstr)+1; + rec.errlen = errorstr == NULL ? 0 : strlen(errorstr)+1; } g_io_channel_write_block(pipe, &rec, sizeof(rec)); - if (rec.error != 0) + if (rec.errlen != 0) g_io_channel_write_block(pipe, (void *) errorstr, rec.errlen); #ifndef WIN32 -- cgit v1.2.3