summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr/getaddrinfo.c
diff options
context:
space:
mode:
authoreric <eric@openbsd.org>2013-05-27 17:31:01 +0000
committereric <eric@openbsd.org>2013-05-27 17:31:01 +0000
commit1ed934d0d08bf9c3f460e8740d169e7606f8702f (patch)
tree7a998af1cd409090f648bb8eda3c9a42717ba397 /lib/libc/asr/getaddrinfo.c
parentNo need to build asr files anymore. (diff)
downloadwireguard-openbsd-1ed934d0d08bf9c3f460e8740d169e7606f8702f.tar.xz
wireguard-openbsd-1ed934d0d08bf9c3f460e8740d169e7606f8702f.zip
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) {