Correct check for DNS request send success
authorUlrich Drepper <drepper@gmail.com>
Fri, 30 Mar 2012 12:27:11 +0000 (08:27 -0400)
committerUlrich Drepper <drepper@gmail.com>
Fri, 30 Mar 2012 12:27:11 +0000 (08:27 -0400)
This predates the sendmmsg use.  The two requests can use different
request sizes but the check for successful transfer always only used
buflen.

ChangeLog
resolv/res_send.c

index fd46252..2dd220e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 2012-03-30  Ulrich Drepper  <drepper@gmail.com>
 
        * resolv/res_send.c (send_dg): Use sendmmsg if we have to write two
-       requests to save a system call.
+       requests to save a system call.  Fix check that all bytes are sent.
 
        * sysdeps/unix/sysv/linux/bits/socket.h (struct mmsghdr): Fix up
        comments for sendmmsg.
index 0b5bc91..968ede0 100644 (file)
@@ -1171,7 +1171,7 @@ send_dg(res_state statp,
                    else
                      sr = send (pfd[0].fd, buf, buflen, MSG_NOSIGNAL);
 
-                   if (sr != buflen) {
+                   if (sr != (nwritten != 0 ? buflen2 : buflen)) {
                      if (errno == EINTR || errno == EAGAIN)
                        goto recompute_resend;
                      Perror(statp, stderr, "send", errno);