changeset 29740:5be4137c4a68

util: Bah, AF_INET6 probably isn't always available
author Paul Aurich <paul@darkrain42.org>
date Fri, 16 Apr 2010 03:44:18 +0000
parents 983a04639c2b
children 35a1cf247168
files libpurple/util.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Fri Apr 16 03:29:10 2010 +0000
+++ b/libpurple/util.c	Fri Apr 16 03:44:18 2010 +0000
@@ -2986,8 +2986,9 @@
 		struct sockaddr_in *ipv4 = (struct sockaddr_in *)&addr;
 		struct in_addr addr = ipv4->sin_addr;
 		return g_strdup(inet_ntoa(addr));
-	} else if (family == AF_INET6) {
-#ifdef HAVE_INET_NTOP
+	}
+#if defined(AF_INET6) && defined(HAVE_INET_NTOP)
+	else if (family == AF_INET6) {
 		struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)&addr;
 		struct in6_addr addr = ipv6->sin6_addr;
 		char host[INET6_ADDRSTRLEN];
@@ -2995,11 +2996,8 @@
 
 		tmp = inet_ntop(family, &addr, host, sizeof(host));
 		return g_strdup(tmp);
-#else /* HAVE_INET_NTOP */
-		/* TODO: Patches welcome...I guess? */
-		return NULL;
+	}
 #endif
-	}
 
 	return NULL;
 }