(send_dg): Fix ignoring timeout or failure.
authordrepper <drepper>
Sat, 24 May 2008 17:51:36 +0000 (17:51 +0000)
committerdrepper <drepper>
Sat, 24 May 2008 17:51:36 +0000 (17:51 +0000)
resolv/res_send.c

index d041304..e78ff96 100644 (file)
@@ -1002,10 +1002,11 @@ send_dg(res_state statp,
        }
        if (n == 0) {
                Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
-               if (recvresp1)
-                 return resplen;
-               if (buf2 != NULL && recvresp2)
-                 return 1;
+               if (recvresp1 || (buf2 != NULL && recvresp2))
+                 {
+                   *resplen2 = 1;
+                   return resplen;
+                 }
 
                *gotsomewhere = 1;
                return (0);
@@ -1184,10 +1185,22 @@ send_dg(res_state statp,
                                (*thisresplen > *thisanssiz)
                                ? *thisanssiz : *thisresplen);
 
-                       if (recvresp1)
-                         return resplen;
-                       if (buf2 != NULL && recvresp2)
-                         return 1;
+                       if (recvresp1 || (buf2 != NULL && recvresp2))
+                         {
+                           *resplen2 = 1;
+                           return resplen;
+                         }
+                       if (buf2 != NULL)
+                         {
+                           /* We are waiting for a possible second reply.  */
+                           resplen = 1;
+                           if (hp->id == anhp->id)
+                             recvresp1 = 1;
+                           else
+                             recvresp2 = 1;
+
+                           goto wait;
+                         }
 
                next_ns:
                        __res_iclose(statp, false);