[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r6526 - in /fsf/trunk/libc: ChangeLog resolv/res_query.c resolv/res_send.c



Author: eglibc
Date: Thu Jul 10 00:03:54 2008
New Revision: 6526

Log:
Import glibc-mainline for 2008-07-10

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/resolv/res_query.c
    fsf/trunk/libc/resolv/res_send.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Jul 10 00:03:54 2008
@@ -1,3 +1,13 @@
+2008-07-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/res_send.c: Remove unnecessary res_pquery prototype.
+
+	* resolv/res_query.c (__libc_res_nquery): Issue debug message only
+	if DEBUG is defined.
+
+	* resolv/res_query.c (__libc_res_nquery): Align buffer for T_AAAA
+	query.  Adjust buffer size computation for padding.
+
 2008-07-08  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* stdio-common/Makefile: Add rules to build and run tst-setvbuf1.

Modified: fsf/trunk/libc/resolv/res_query.c
==============================================================================
--- fsf/trunk/libc/resolv/res_query.c (original)
+++ fsf/trunk/libc/resolv/res_query.c Thu Jul 10 00:03:54 2008
@@ -146,18 +146,34 @@
 	      {
 		if ((oflags & RES_F_EDNS0ERR) == 0
 		    && (statp->options & RES_USE_EDNS0) != 0)
-		  n = __res_nopt(statp, n, query1, bufsize, anslen / 2);
+		  {
+		    n = __res_nopt(statp, n, query1, bufsize, anslen / 2);
+		    if (n < 0)
+		      goto unspec_nomem;
+		  }
 
 		nquery1 = n;
-		query2 = buf + nquery1;
+		/* Align the buffer.  */
+		int npad = ((nquery1 + __alignof__ (HEADER) - 1)
+			    & ~(__alignof__ (HEADER) - 1)) - nquery1;
+		if (n > bufsize - npad)
+		  {
+		    n = -1;
+		    goto unspec_nomem;
+		  }
+		int nused = n + npad;
+		query2 = buf + nused;
 		n = res_nmkquery(statp, QUERY, name, class, T_AAAA, NULL, 0,
-				 NULL, query2, bufsize - n);
+				 NULL, query2, bufsize - nused);
 		if (n > 0
 		    && (oflags & RES_F_EDNS0ERR) == 0
 		    && (statp->options & RES_USE_EDNS0) != 0)
-		  n = __res_nopt(statp, n, query2, bufsize - n, anslen / 2);
+		  n = __res_nopt(statp, n, query2, bufsize - nused - n,
+				 anslen / 2);
 		nquery2 = n;
 	      }
+
+	  unspec_nomem:;
 	  }
 	else
 	  {
@@ -188,8 +204,10 @@
 		if ((statp->options & RES_USE_EDNS0) != 0
 		    && ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) {
 			statp->_flags |= RES_F_EDNS0ERR;
+#ifdef DEBUG
 			if (statp->options & RES_DEBUG)
 				printf(";; res_nquery: retry without EDNS0\n");
+#endif
                         goto again;
 		}
 #ifdef DEBUG

Modified: fsf/trunk/libc/resolv/res_send.c
==============================================================================
--- fsf/trunk/libc/resolv/res_send.c (original)
+++ fsf/trunk/libc/resolv/res_send.c Thu Jul 10 00:03:54 2008
@@ -194,7 +194,6 @@
 /* Reachover. */
 
 static void convaddr4to6(struct sockaddr_in6 *sa);
-void res_pquery(const res_state, const u_char *, int, FILE *);
 
 /* Public. */