summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2013-12-12 12:37:39 -0800
committerRobert Greenwalt <rgreenwalt@google.com>2013-12-12 21:34:36 +0000
commit5fddfb89152a008c8de3e883ff1af28dc8b2cc70 (patch)
tree51db929ca0ac007328f52d93f73a8d78112a4918
parent5ab8d33aa64a4ca12172dba92df172f70629874d (diff)
downloadbionic-5fddfb89152a008c8de3e883ff1af28dc8b2cc70.zip
bionic-5fddfb89152a008c8de3e883ff1af28dc8b2cc70.tar.gz
bionic-5fddfb89152a008c8de3e883ff1af28dc8b2cc70.tar.bz2
Fix dns searchdomain use in gethostbyname.
Need to load search domain data before we attempt to use it. This is a cherry pick of an AOSP change c11f6f0f393e472984b5ac2934e2485855a319c9. bug:6799630 Change-Id: I4ea1131f06ffdf4037fe67f82af5a0349469b609
-rw-r--r--libc/netbsd/resolv/res_query.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc/netbsd/resolv/res_query.c b/libc/netbsd/resolv/res_query.c
index 8e1321e..d31e83c 100644
--- a/libc/netbsd/resolv/res_query.c
+++ b/libc/netbsd/resolv/res_query.c
@@ -272,6 +272,15 @@ res_nsearch(res_state statp,
(dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0U)) {
int done = 0;
+ /* Unfortunately we need to load interface info
+ * (dns servers, search domains) before
+ * the domain stuff is tried. Will have a better
+ * fix after thread pools are used as this will
+ * be loaded once for the thread instead of each
+ * time a query is tried.
+ */
+ _resolv_populate_res_for_iface(statp);
+
for (domain = (const char * const *)statp->dnsrch;
*domain && !done;
domain++) {