From 01be8708e9cbccf4c7ca951853d072fdd2e48c9c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 11 Jun 2009 19:09:08 +0000 Subject: [PATCH] Fix compile on cygwin. This isnt the solution I would like: I would prefer to get pton and ntop to work even when AF_INET6 is not defined. svn:r1326 --- evutil.c | 9 +++++++-- ipv6-internal.h | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/evutil.c b/evutil.c index 5b380344..5f8f9b9a 100644 --- a/evutil.c +++ b/evutil.c @@ -644,7 +644,9 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int * if (!addr_part) return -1; /* Should be impossible. */ - if (is_ipv6) { +#ifdef AF_INET6 + if (is_ipv6) + { struct sockaddr_in6 sin6; memset(&sin6, 0, sizeof(sin6)); #ifdef _EVENT_HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN @@ -660,7 +662,10 @@ evutil_parse_sockaddr_port(const char *ip_as_string, struct sockaddr *out, int * memcpy(out, &sin6, sizeof(sin6)); *outlen = sizeof(sin6); return 0; - } else { + } + else +#endif + { struct sockaddr_in sin; memset(&sin, 0, sizeof(sin)); #ifdef _EVENT_HAVE_STRUCT_SOCKADDR_IN_SIN_LEN diff --git a/ipv6-internal.h b/ipv6-internal.h index f1b34226..3cdcea62 100644 --- a/ipv6-internal.h +++ b/ipv6-internal.h @@ -31,6 +31,9 @@ #define _EVENT_IPV6_INTERNAL_H #include +#ifdef _EVENT_HAVE_SYS_SOCKET_H +#include +#endif #include "event-config.h" #include