# HG changeset patch # User Matt Johnston # Date 1104667485 0 # Node ID 7ceceb46d655016af8f95558bcec20fef091eae8 # Parent 4bd4fc8023bd52ed18b6c7d5f90ab69befa2e374 Fix so that getnameinfo() is passed the address-specific structure size. This lets it work on Solaris (and probably other platforms) diff -r 4bd4fc8023bd -r 7ceceb46d655 dbutil.c --- a/dbutil.c Mon Dec 27 16:38:44 2004 +0000 +++ b/dbutil.c Sun Jan 02 12:04:45 2005 +0000 @@ -357,6 +357,16 @@ unsigned int len; len = sizeof(struct sockaddr_storage); + /* Some platforms such as Solaris 8 require that len is the length + * of the specific structure. */ + if (addr->ss_family == AF_INET) { + len = sizeof(struct sockaddr_in); + } +#ifdef AF_INET6 + if (addr->ss_family == AF_INET6) { + len = sizeof(struct sockaddr_in6); + } +#endif ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICSERV | NI_NUMERICHOST); @@ -389,6 +399,16 @@ unsigned int len; len = sizeof(struct sockaddr_storage); + /* Some platforms such as Solaris 8 require that len is the length + * of the specific structure. */ + if (addr->ss_family == AF_INET) { + len = sizeof(struct sockaddr_in); + } +#ifdef AF_INET6 + if (addr->ss_family == AF_INET6) { + len = sizeof(struct sockaddr_in6); + } +#endif ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICSERV);