summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/gethostnamadr.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2006-05-12 15:37:23 +0000
committerume <ume@FreeBSD.org>2006-05-12 15:37:23 +0000
commitab3eacdf3106cb0b4027a6d928d9555815af0b48 (patch)
tree164cb97bf2cd0fc04b8135b782152c0960ca3354 /lib/libc/net/gethostnamadr.c
parent08978d5bee9bfc81ae25a6b3a8971577532cc9aa (diff)
downloadFreeBSD-src-ab3eacdf3106cb0b4027a6d928d9555815af0b48.zip
FreeBSD-src-ab3eacdf3106cb0b4027a6d928d9555815af0b48.tar.gz
Fix gethostbyaddr() prototype to conform to IEEE Std 1003.1:
http://www.opengroup.org/onlinepubs/009695399/functions/gethostbyaddr.html gethostbyaddr_r() is changed as well. It breaks ABI backward compatibility on 64 bit arch. So, we fix it on 32 bit arch only for now. Reported by: Rostislav Krasny <rosti.bsd@gmail.com>
Diffstat (limited to 'lib/libc/net/gethostnamadr.c')
-rw-r--r--lib/libc/net/gethostnamadr.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index 965af66..7ff3500 100644
--- a/lib/libc/net/gethostnamadr.c
+++ b/lib/libc/net/gethostnamadr.c
@@ -573,8 +573,14 @@ gethostbyname_internal(const char *name, int af, struct hostent *hp, char *buf,
}
int
-gethostbyaddr_r(const char *addr, int len, int af, struct hostent *hp,
- char *buf, size_t buflen, struct hostent **result, int *h_errnop)
+gethostbyaddr_r(const void *addr,
+#if __LONG_BIT == 64
+ int len,
+#else
+ socklen_t len,
+#endif
+ int af, struct hostent *hp, char *buf, size_t buflen,
+ struct hostent **result, int *h_errnop)
{
const u_char *uaddr = (const u_char *)addr;
const struct in6_addr *addr6;
@@ -606,7 +612,7 @@ gethostbyaddr_r(const char *addr, int len, int af, struct hostent *hp,
}
if (af == AF_INET6 && len == NS_IN6ADDRSZ) {
- addr6 = (const struct in6_addr *)(const void *)uaddr;
+ addr6 = (const struct in6_addr *)addr;
if (IN6_IS_ADDR_LINKLOCAL(addr6)) {
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);
*h_errnop = statp->res_h_errno;
@@ -678,7 +684,11 @@ gethostbyname2(const char *name, int af)
}
struct hostent *
-gethostbyaddr(const char *addr, int len, int af)
+#if __LONG_BIT == 64
+gethostbyaddr(const void *addr, int len, int af)
+#else
+gethostbyaddr(const void *addr, socklen_t len, int af)
+#endif
{
struct hostdata *hd;
struct hostent *rval;
OpenPOWER on IntegriCloud