summaryrefslogtreecommitdiff
path: root/src/core/network.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-03-14 22:26:00 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-03-14 22:26:00 +0000
commitadec7641f02cef7fa6d252381e4d70c05bcb8d12 (patch)
treeef7afce969e3faba8d1bb8f79b8036a65a27c14c /src/core/network.c
parent1d453ed92c17c657e1a9984b6566a6f761214237 (diff)
downloadirssi-adec7641f02cef7fa6d252381e4d70c05bcb8d12.zip
net_listen() works now properly with --enable-ipv6 and a system that doesn't
have a working IPv6 support git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1382 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/network.c')
-rw-r--r--src/core/network.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/network.c b/src/core/network.c
index c5a4e2f1..535cdcf8 100644
--- a/src/core/network.c
+++ b/src/core/network.c
@@ -245,6 +245,15 @@ GIOChannel *net_listen(IPADDR *my_ip, int *port)
/* create the socket */
handle = socket(so.sin.sin_family, SOCK_STREAM, 0);
+#ifdef HAVE_IPV6
+ if (handle == -1 && errno == EINVAL) {
+ /* IPv6 is not supported by OS */
+ so.sin.sin_family = AF_INET;
+ so.sin.sin_addr.s_addr = INADDR_ANY;
+
+ handle = socket(AF_INET, SOCK_STREAM, 0);
+ }
+#endif
if (handle == -1)
return NULL;