summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/net-nonblock.c4
-rw-r--r--src/fe-text/irssi.c19
2 files changed, 20 insertions, 3 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
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index dd567f28..a7e91274 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -223,10 +223,27 @@ static void check_files(void)
g_free(path);
}
+#ifdef WIN32
+static void winsock_init(void)
+{
+ WORD wVersionRequested;
+ WSADATA wsaData;
+
+ wVersionRequested = MAKEWORD(2, 2);
+
+ if (WSAStartup(wVersionRequested, &wsaData) != 0) {
+ printf("Error initializing winsock\n");
+ exit(1);
+ }
+}
+#endif
+
int main(int argc, char **argv)
{
check_files();
-
+#ifdef WIN32
+ winsock_init();
+#endif
#ifdef HAVE_SOCKS
SOCKSinit(argv[0]);
#endif