summaryrefslogtreecommitdiff
path: root/Utilities/cmcurl/lib/inet_pton.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmcurl/lib/inet_pton.c')
-rw-r--r--Utilities/cmcurl/lib/inet_pton.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/Utilities/cmcurl/lib/inet_pton.c b/Utilities/cmcurl/lib/inet_pton.c
index f2e17b8743..7d3c698795 100644
--- a/Utilities/cmcurl/lib/inet_pton.c
+++ b/Utilities/cmcurl/lib/inet_pton.c
@@ -39,14 +39,21 @@
#define INT16SZ 2
/*
+ * If ENABLE_IPV6 is disabled, we still want to parse IPv6 addresses, so make
+ * sure we have _some_ value for AF_INET6 without polluting our fake value
+ * everywhere.
+ */
+#if !defined(ENABLE_IPV6) && !defined(AF_INET6)
+#define AF_INET6 (AF_INET + 1)
+#endif
+
+/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
static int inet_pton4(const char *src, unsigned char *dst);
-#ifdef ENABLE_IPV6
static int inet_pton6(const char *src, unsigned char *dst);
-#endif
/* int
* inet_pton(af, src, dst)
@@ -70,10 +77,8 @@ Curl_inet_pton(int af, const char *src, void *dst)
switch(af) {
case AF_INET:
return (inet_pton4(src, (unsigned char *)dst));
-#ifdef ENABLE_IPV6
case AF_INET6:
return (inet_pton6(src, (unsigned char *)dst));
-#endif
default:
errno = EAFNOSUPPORT;
return (-1);
@@ -135,7 +140,6 @@ inet_pton4(const char *src, unsigned char *dst)
return (1);
}
-#ifdef ENABLE_IPV6
/* int
* inet_pton6(src, dst)
* convert presentation level address to network order binary form.
@@ -234,6 +238,5 @@ inet_pton6(const char *src, unsigned char *dst)
memcpy(dst, tmp, IN6ADDRSZ);
return (1);
}
-#endif /* ENABLE_IPV6 */
#endif /* HAVE_INET_PTON */