From adec7641f02cef7fa6d252381e4d70c05bcb8d12 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 14 Mar 2001 22:26:00 +0000 Subject: [PATCH] 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 --- src/core/network.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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;