summaryrefslogtreecommitdiff
path: root/src/core/net-nonblock.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-10-26 18:57:23 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-10-26 18:57:23 +0000
commite0bc134d66fcb1c0a901e82973701e652c2b5cd0 (patch)
tree6dc20d6c8400b349b41aa2a52a015782103d95a9 /src/core/net-nonblock.c
parentdf10f182c019e7cda96793de193e30e66ab2abfc (diff)
downloadirssi-e0bc134d66fcb1c0a901e82973701e652c2b5cd0.zip
Win32 updates
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@784 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/net-nonblock.c')
-rw-r--r--src/core/net-nonblock.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c
index d8e85b0a..c6342e08 100644
--- a/src/core/net-nonblock.c
+++ b/src/core/net-nonblock.c
@@ -41,10 +41,13 @@ int net_gethostbyname_nonblock(const char *addr, int pipe)
{
RESOLVED_IP_REC rec;
const char *errorstr;
+#ifndef WIN32
int pid;
+#endif
g_return_val_if_fail(addr != NULL, FALSE);
+#ifndef WIN32
pid = fork();
if (pid > 0) {
/* parent */
@@ -57,6 +60,7 @@ int net_gethostbyname_nonblock(const char *addr, int pipe)
g_warning("net_connect_thread(): fork() failed! "
"Using blocking resolving");
}
+#endif
/* child */
memset(&rec, 0, sizeof(rec));
@@ -72,8 +76,10 @@ int net_gethostbyname_nonblock(const char *addr, int pipe)
if (rec.error != 0)
write(pipe, errorstr, rec.errlen);
+#ifndef WIN32
if (pid == 0)
_exit(99);
+#endif
/* we used blocking lookup */
return 0;
@@ -89,7 +95,9 @@ int net_gethostbyname_return(int pipe, RESOLVED_IP_REC *rec)
rec->errorstr = NULL;
/* get ip+error - try for max. 1-2 seconds */
+#ifndef WIN32
fcntl(pipe, F_SETFL, O_NONBLOCK);
+#endif
maxwait = time(NULL)+2;
len = 0;
@@ -134,7 +142,9 @@ void net_disconnect_nonblock(int pid)
{
g_return_if_fail(pid > 0);
+#ifndef WIN32
kill(pid, SIGKILL);
+#endif
}
static void simple_init(SIMPLE_THREAD_REC *rec, int handle)