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

[commits] r7492 - in /fsf/trunk/libc: ./ nis/nss_nis/ resolv/ sysdeps/unix/sysv/linux/



Author: eglibc
Date: Mon Dec  8 00:01:36 2008
New Revision: 7492

Log:
Import glibc-mainline for 2008-12-08

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/nis/nss_nis/nis-hosts.c
    fsf/trunk/libc/resolv/res_init.c
    fsf/trunk/libc/resolv/res_send.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Dec  8 00:01:36 2008
@@ -1,3 +1,17 @@
+2008-12-07  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/res_send.c (send_dg): Use correct guards for SOCK_CLOEXEC
+	use.
+
+	* sysdeps/unix/sysv/linux/kernel-features.h: Fix typo in accept4
+	handling.
+
+	* resolv/res_init.c (__res_vinit): Always assign to statp->nscount
+	after reading name server list.
+
+	* nis/nss_nis/nis-hosts.c (_nss_nis_gethostbyname4_r): Fix memory
+	handling for host name aliases.
+
 2008-12-05  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* posix/globtest.sh: Use mktemp to create temporary file and

Modified: fsf/trunk/libc/nis/nss_nis/nis-hosts.c
==============================================================================
--- fsf/trunk/libc/nis/nss_nis/nis-hosts.c (original)
+++ fsf/trunk/libc/nis/nss_nis/nis-hosts.c Mon Dec  8 00:01:36 2008
@@ -485,24 +485,6 @@
       return retval;
     }
 
-  struct parser_data data;
-  struct hostent host;
-  int parse_res = parse_line (result, &host, &data, buflen, errnop, AF_UNSPEC,
-			      0);
-  if (__builtin_expect (parse_res < 1, 0))
-    {
-      if (parse_res == -1)
-	{
-	  *herrnop = NETDB_INTERNAL;
-	  return NSS_STATUS_TRYAGAIN;
-	}
-      else
-	{
-	  *herrnop = HOST_NOT_FOUND;
-	  return NSS_STATUS_NOTFOUND;
-	}
-    }
-
   if (*pat == NULL)
     {
       uintptr_t pad = (-(uintptr_t) buffer
@@ -524,16 +506,47 @@
       buflen -= sizeof (struct gaih_addrtuple);
     }
 
+  uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct parser_data);
+  buffer += pad;
+
+  struct parser_data *data = (void *) buffer;
+
+  if (__builtin_expect (buflen < sizeof *data + 1 + pad, 0))
+    goto erange;
+  buflen -= pad;
+
+  struct hostent host;
+  int parse_res = parse_line (result, &host, data, buflen, errnop, AF_UNSPEC,
+			      0);
+  if (__builtin_expect (parse_res < 1, 0))
+    {
+      if (parse_res == -1)
+	{
+	  *herrnop = NETDB_INTERNAL;
+	  return NSS_STATUS_TRYAGAIN;
+	}
+      else
+	{
+	  *herrnop = HOST_NOT_FOUND;
+	  return NSS_STATUS_NOTFOUND;
+	}
+    }
+
   (*pat)->next = NULL;
-  size_t h_name_len = strlen (host.h_name);
-  if (h_name_len >= buflen)
-    goto erange;
-  (*pat)->name = memcpy (buffer, host.h_name, h_name_len + 1);
   (*pat)->family = host.h_addrtype;
   memcpy ((*pat)->addr, host.h_addr_list[0], host.h_length);
   (*pat)->scopeid = 0;
   assert (host.h_addr_list[1] == NULL);
 
+  /* Undo the alignment for parser_data.  */
+  buffer -= pad;
+  buflen += pad;
+
+  size_t h_name_len = strlen (host.h_name) + 1;
+  if (h_name_len >= buflen)
+    goto erange;
+  (*pat)->name = memcpy (buffer, host.h_name, h_name_len);
+
   free (result);
 
   return NSS_STATUS_SUCCESS;

Modified: fsf/trunk/libc/resolv/res_init.c
==============================================================================
--- fsf/trunk/libc/resolv/res_init.c (original)
+++ fsf/trunk/libc/resolv/res_init.c Mon Dec  8 00:01:36 2008
@@ -420,8 +420,7 @@
 		    continue;
 		}
 	    }
-	    if (nserv > 1)
-		statp->nscount = nserv;
+	    statp->nscount = nserv;
 #ifdef _LIBC
 	    if (nservall - nserv > 0) {
 		statp->_u._ext.nscount6 = nservall - nserv;

Modified: fsf/trunk/libc/resolv/res_send.c
==============================================================================
--- fsf/trunk/libc/resolv/res_send.c (original)
+++ fsf/trunk/libc/resolv/res_send.c Mon Dec  8 00:01:36 2008
@@ -104,7 +104,7 @@
 #endif
 
 
-#ifndef __ASSUME_O_CLOEXEC
+#ifndef __ASSUME_SOCK_CLOEXEC
 static int __have_o_nonblock;
 #else
 # define __have_o_nonblock 0
@@ -932,7 +932,7 @@
 				EXT(statp).nssocks[ns] =
 				  socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK,
 					 0);
-#ifndef __ASSUME_O_CLOEXEC
+#ifndef __ASSUME_SOCK_CLOEXEC
 				if (__have_o_nonblock == 0)
 					__have_o_nonblock
 					  = (EXT(statp).nssocks[ns] == -1
@@ -954,7 +954,7 @@
 				EXT(statp).nssocks[ns]
 				  = socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK,
 					   0);
-#ifndef __ASSUME_O_CLOEXEC
+#ifndef __ASSUME_SOCK_CLOEXEC
 				if (__have_o_nonblock == 0)
 					__have_o_nonblock
 					  = (EXT(statp).nssocks[ns] == -1

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Mon Dec  8 00:01:36 2008
@@ -512,7 +512,7 @@
 #endif
 
 /* Support for the accept4 syscall was added in 2.6.28.  */
-#if __LINUX_KERNEL_VERSION >= 0x02061b \
+#if __LINUX_KERNEL_VERSION >= 0x02061c \
     && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
 	|| defined __ia64__ || defined __sparc__ || __s390__)
 # define __ASSUME_ACCEPT4	1