summaryrefslogtreecommitdiff
path: root/src/core/net-nonblock.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-12-05 19:43:12 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-12-05 19:43:12 +0000
commit346808789cfd3556b8caf263bdd81982d6081296 (patch)
tree225e71d34eb28c190b3384e1d83b27c7fe8f5632 /src/core/net-nonblock.c
parent4316840890b7b14b1fe05f5548f333fe0ff8ec62 (diff)
downloadirssi-346808789cfd3556b8caf263bdd81982d6081296.zip
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
Diffstat (limited to 'src/core/net-nonblock.c')
-rw-r--r--src/core/net-nonblock.c4
1 files changed, 2 insertions, 2 deletions
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