diff options
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/res_query.c | 15 | ||||
-rw-r--r-- | resolv/res_send.c | 7 |
2 files changed, 22 insertions, 0 deletions
diff --git a/resolv/res_query.c b/resolv/res_query.c index a8e8d7b739..3d2f2fe3a9 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -224,6 +224,21 @@ __libc_res_nquery(res_state statp, tests of HP2. */ HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp; + if (n < sizeof (HEADER) && nanswerp2 != NULL + && *nanswerp2 > sizeof (HEADER)) + { + /* Special case of partial answer. */ + assert (hp != hp2); + hp = hp2; + } + else if (nanswerp2 != NULL + && *nanswerp2 < sizeof (HEADER) && n > sizeof (HEADER)) + { + /* Special case of partial answer. */ + assert (hp != hp2); + hp2 = hp; + } + if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0) && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) { #ifdef DEBUG diff --git a/resolv/res_send.c b/resolv/res_send.c index b3dbd702a2..e67ef1c676 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -975,6 +975,8 @@ send_dg(res_state statp, int recvresp2 = buf2 == NULL; pfd[0].fd = EXT(statp).nssocks[ns]; pfd[0].events = POLLOUT; + if (resplen2 != NULL) + *resplen2 = 0; wait: if (need_recompute) { recompute_resend: @@ -1001,6 +1003,11 @@ send_dg(res_state statp, if (n == 0) { Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout sending\n")); + if (recvresp1) + return resplen; + if (buf2 != NULL && recvresp2) + return 1; + *gotsomewhere = 1; return (0); } |