From 03d78bbb31828d7ba7e578e5d7c76e7229c67b62 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Mon, 28 Feb 2005 10:15:16 +0000 Subject: * respect DO_HOST_LOOKUP config option --HG-- extra : convert_revision : ab193dd162b03bdd935759fa667ff394a5e29734 --- dbutil.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'dbutil.c') diff --git a/dbutil.c b/dbutil.c index 3ead979..fbe170d 100644 --- a/dbutil.c +++ b/dbutil.c @@ -397,6 +397,11 @@ char* getaddrhostname(struct sockaddr_storage * addr) { char sbuf[NI_MAXSERV]; int ret; unsigned int len; +#ifdef DO_HOST_LOOKUP + const int flags = NI_NUMERICSERV; +#else + const int flags = NI_NUMERICHOST | NI_NUMERICSERV; +#endif len = sizeof(struct sockaddr_storage); /* Some platforms such as Solaris 8 require that len is the length @@ -410,8 +415,9 @@ char* getaddrhostname(struct sockaddr_storage * addr) { } #endif + ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf), - sbuf, sizeof(sbuf), NI_NUMERICSERV); + sbuf, sizeof(sbuf), flags); if (ret != 0) { /* On some systems (Darwin does it) we get EINTR from getnameinfo -- cgit v1.2.3