summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irc/irc-server.c15
-rw-r--r--weechat/src/irc/irc-server.c15
2 files changed, 26 insertions, 4 deletions
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 06eeec381..b5be7c329 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -1744,7 +1744,9 @@ int
irc_server_connect (t_irc_server *server)
{
int child_pipe[2], set;
+#ifndef __CYGWIN__
pid_t pid;
+#endif
#ifndef HAVE_GNUTLS
if (server->ssl)
@@ -1854,7 +1856,16 @@ irc_server_connect (t_irc_server *server)
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
WEECHAT_WARNING);
}
-
+
+#ifdef __CYGWIN__
+ /* connection may block under Cygwin, there's no other known way
+ to do better today, since connect() in child process seems not to work
+ any suggestion is welcome to improve that!
+ */
+ irc_server_child (server);
+ server->child_pid = 0;
+ irc_server_child_read (server);
+#else
switch (pid = fork ())
{
/* fork failed */
@@ -1867,9 +1878,9 @@ irc_server_connect (t_irc_server *server)
irc_server_child (server);
_exit (EXIT_SUCCESS);
}
-
/* parent process */
server->child_pid = pid;
+#endif
return 1;
}
diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c
index 06eeec381..b5be7c329 100644
--- a/weechat/src/irc/irc-server.c
+++ b/weechat/src/irc/irc-server.c
@@ -1744,7 +1744,9 @@ int
irc_server_connect (t_irc_server *server)
{
int child_pipe[2], set;
+#ifndef __CYGWIN__
pid_t pid;
+#endif
#ifndef HAVE_GNUTLS
if (server->ssl)
@@ -1854,7 +1856,16 @@ irc_server_connect (t_irc_server *server)
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
WEECHAT_WARNING);
}
-
+
+#ifdef __CYGWIN__
+ /* connection may block under Cygwin, there's no other known way
+ to do better today, since connect() in child process seems not to work
+ any suggestion is welcome to improve that!
+ */
+ irc_server_child (server);
+ server->child_pid = 0;
+ irc_server_child_read (server);
+#else
switch (pid = fork ())
{
/* fork failed */
@@ -1867,9 +1878,9 @@ irc_server_connect (t_irc_server *server)
irc_server_child (server);
_exit (EXIT_SUCCESS);
}
-
/* parent process */
server->child_pid = pid;
+#endif
return 1;
}