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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index fcfc979..d5644a8 100644
--- a/lib/libc/net/gethostnamadr.c
+++ b/lib/libc/net/gethostnamadr.c
@@ -61,6 +61,10 @@ gethostbyname(const char *name)
{
struct hostent *hp;
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (NULL);
+ }
if (_res.options & RES_USE_INET6) { /* XXX */
hp = gethostbyname2(name, AF_INET6); /* XXX */
if (hp) /* XXX */
OpenPOWER on IntegriCloud