This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.15-528-g966977f


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  966977f1b72123bdd5187a60e9b50eaa70312d90 (commit)
       via  8e6d108343c2f15d684b84fa48b73b23eb0e7c8b (commit)
      from  c030f70c8796c7743c3aa97d6beff3bd5b8dcd5d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=966977f1b72123bdd5187a60e9b50eaa70312d90

commit 966977f1b72123bdd5187a60e9b50eaa70312d90
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Fri Mar 30 08:38:58 2012 -0400

    Better error handling for sendmmsg use in res_send

diff --git a/resolv/res_send.c b/resolv/res_send.c
index 968ede0..0a28cd7 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -1132,22 +1132,23 @@ send_dg(res_state statp,
 		    int ndg = sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
 		    if (__builtin_expect (ndg == 2, 1))
 		      {
-			assert (reqs[0].msg_len == buflen);
-			assert (reqs[1].msg_len == buflen2);
+			if (reqs[0].msg_len != buflen
+			    || reqs[1].msg_len != buflen2)
+			  goto fail_sendmmsg;
 
 			pfd[0].events = POLLIN;
 			nwritten += 2;
 		      }
 		    else if (ndg == 1 && reqs[0].msg_len == buflen)
 		      goto just_one;
-		    else if (errno == EINTR || errno == EAGAIN)
+		    else if (ndg < 0 && (errno == EINTR || errno == EAGAIN))
 		      goto recompute_resend;
 		    else
 		      {
 #ifndef __ASSUME_SENDMMSG
-			if (have_sendmmsg == 0)
+			if (__builtin_expect (have_sendmmsg == 0, 0))
 			  {
-			    if (errno == ENOSYS)
+			    if (ndg < 0 && errno == ENOSYS)
 			      {
 				have_sendmmsg = -1;
 				goto try_send;
@@ -1156,6 +1157,7 @@ send_dg(res_state statp,
 			  }
 #endif
 
+		      fail_sendmmsg:
 			Perror(statp, stderr, "sendmmsg", errno);
 			goto err_out;
 		      }

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8e6d108343c2f15d684b84fa48b73b23eb0e7c8b

commit 8e6d108343c2f15d684b84fa48b73b23eb0e7c8b
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Fri Mar 30 08:27:11 2012 -0400

    Correct check for DNS request send success
    
    This predates the sendmmsg use.  The two requests can use different
    request sizes but the check for successful transfer always only used
    buflen.

diff --git a/ChangeLog b/ChangeLog
index fd46252..2dd220e 100644
--- 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.
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 0b5bc91..968ede0 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -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);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    2 +-
 resolv/res_send.c |   14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]