commit 44cc23ffa6ad06964719eeb8f4483ad305dc6ac5 Author: Taylor R Campbell campbell+torsocks@mumble.net Date: Tue Jun 16 20:22:17 2015 +0000
Work around broken declaration of gethostbyaddr on older NetBSD.
Signed-off-by: David Goulet dgoulet@ev0ke.net --- src/lib/torsocks.h | 4 ++++ tests/test_dns.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lib/torsocks.h b/src/lib/torsocks.h index f8f798f..9531db5 100644 --- a/src/lib/torsocks.h +++ b/src/lib/torsocks.h @@ -154,7 +154,11 @@ struct hostent **result, int *h_errnop #define LIBC_GETHOSTBYADDR_NAME gethostbyaddr #define LIBC_GETHOSTBYADDR_NAME_STR XSTR(LIBC_GETHOSTBYADDR_NAME) #define LIBC_GETHOSTBYADDR_RET_TYPE struct hostent * +#if defined(__NetBSD__) && __NetBSD_Version__ < 699002400 +#define LIBC_GETHOSTBYADDR_SIG const char *addr, socklen_t len, int type +#else #define LIBC_GETHOSTBYADDR_SIG const void *addr, socklen_t len, int type +#endif #define LIBC_GETHOSTBYADDR_ARGS addr, len, type
/* GNU extension. Reentrant version. */ diff --git a/tests/test_dns.c b/tests/test_dns.c index 03ce976..1ca3827 100644 --- a/tests/test_dns.c +++ b/tests/test_dns.c @@ -86,7 +86,7 @@ static void test_gethostbyaddr(const struct test_host *host)
addr = inet_addr(host->ip);
- he = gethostbyaddr(&addr, INET_ADDRSTRLEN, AF_INET); + he = gethostbyaddr((const void *)&addr, INET_ADDRSTRLEN, AF_INET); if (he) { ok(strcmp(host->name, he->h_name) == 0, "Resolving address %s", host->ip);
tor-commits@lists.torproject.org