summaryrefslogtreecommitdiff
path: root/lib/libc/asr/getaddrinfo.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2013-05-27 17:31:02 +0000
committerEric Faurot <eric@cvs.openbsd.org>2013-05-27 17:31:02 +0000
commit595fac8a14905c9e48e876b0dfb69492af15bf6b (patch)
tree89313f5e551ef8cb78a4c587c63453f5fda9c8ed /lib/libc/asr/getaddrinfo.c
parent3db28768772e2df85e857d3071948ff3eea00f09 (diff)
Add minimal support for _res setup and update.
Change res_init() to initialize the _res structure on first call, and udpate the global async context if changes were made by the user. All resolver functions now call res_init() internally. fixes issue spotted by otto@
Diffstat (limited to 'lib/libc/asr/getaddrinfo.c')
-rw-r--r--lib/libc/asr/getaddrinfo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/asr/getaddrinfo.c b/lib/libc/asr/getaddrinfo.c
index 84b11ce5b80..9e8ba91c5b2 100644
--- a/lib/libc/asr/getaddrinfo.c
+++ b/lib/libc/asr/getaddrinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo.c,v 1.1 2012/09/08 11:08:21 eric Exp $ */
+/* $OpenBSD: getaddrinfo.c,v 1.2 2013/05/27 17:31:01 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -31,6 +31,8 @@ getaddrinfo(const char *hostname, const char *servname,
struct async_res ar;
int saved_errno = errno;
+ res_init();
+
as = getaddrinfo_async(hostname, servname, hints, NULL);
if (as == NULL) {
if (errno == ENOMEM) {