summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/gethostnamadr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/net/gethostnamadr.c')
-rw-r--r--lib/libc/net/gethostnamadr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index 8aae192..0646b0c 100644
--- a/lib/libc/net/gethostnamadr.c
+++ b/lib/libc/net/gethostnamadr.c
@@ -264,6 +264,11 @@ gethostbyaddr_r(const char *addr, int len, int af, struct hostent *he,
{ 0 }
};
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return -1;
+ }
+
if (af == AF_INET6 && len == IN6ADDRSZ) {
addr6 = (const struct in6_addr *)(const void *)uaddr;
if (IN6_IS_ADDR_LINKLOCAL(addr6)) {
OpenPOWER on IntegriCloud