diff options
Diffstat (limited to 'resolv/res_query.c')
-rw-r--r-- | resolv/res_query.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/resolv/res_query.c b/resolv/res_query.c index a9db837a01..4e6612c283 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -382,7 +382,9 @@ __libc_res_nsearch(res_state statp, answer, anslen, answerp, answerp2, nanswerp2, resplen2, answerp2_malloced); - if (ret > 0 || trailing_dot) + if (ret > 0 || trailing_dot + /* If the second response is valid then we use that. */ + || (ret == 0 && answerp2 != NULL && resplen2 > 0)) return (ret); saved_herrno = h_errno; tried_as_is++; @@ -422,7 +424,8 @@ __libc_res_nsearch(res_state statp, answer, anslen, answerp, answerp2, nanswerp2, resplen2, answerp2_malloced); - if (ret > 0) + if (ret > 0 || (ret == 0 && answerp2 != NULL + && resplen2 > 0)) return (ret); if (answerp && *answerp != answer) { |