summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-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