(send_dg): If we already have one of two answers and the server reports
authordrepper <drepper>
Sat, 24 May 2008 17:35:58 +0000 (17:35 +0000)
committerdrepper <drepper>
Sat, 24 May 2008 17:35:58 +0000 (17:35 +0000)
SERVFAI, NOTIMP, or REFUSED, then use the one answer insted of failing.

resolv/res_send.c

index e67ef1c..d041304 100644 (file)
@@ -1001,8 +1001,7 @@ send_dg(res_state statp,
                need_recompute = 1;
        }
        if (n == 0) {
-               Dprint(statp->options & RES_DEBUG, (stdout,
-                                                   ";; timeout sending\n"));
+               Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
                if (recvresp1)
                  return resplen;
                if (buf2 != NULL && recvresp2)
@@ -1184,6 +1183,12 @@ send_dg(res_state statp,
                                thisansp,
                                (*thisresplen > *thisanssiz)
                                ? *thisanssiz : *thisresplen);
+
+                       if (recvresp1)
+                         return resplen;
+                       if (buf2 != NULL && recvresp2)
+                         return 1;
+
                next_ns:
                        __res_iclose(statp, false);
                        /* don't retry if called from dig */