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

[commits] r10767 - in /fsf/trunk/libc: ./ posix/ sysdeps/unix/sysv/linux/



Author: eglibc
Date: Sun Jun 20 00:03:47 2010
New Revision: 10767

Log:
Import glibc-mainline for 2010-06-20

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/posix/group_member.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Jun 20 00:03:47 2010
@@ -1,3 +1,15 @@
+2010-06-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #11701]
+	* posix/group_member.c (__group_member): Correct checking loop.
+
+	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Handle
+	OOM in getpwuid_r correctly.  Return error number when the caller
+	should return, otherwise -1.
+	(getlogin_r): Adjust to return also for result of __getlogin_r_loginuid
+	call returning > 0 value.
+	* sysdeps/unix/sysv/linux/getlogin.c (getlogin): Likewise.
+
 2010-06-07  Andreas Schwab  <schwab@xxxxxxxxxx>
 
 	* dlfcn/Makefile: Remove explicit dependencies on libc.so and

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sun Jun 20 00:03:47 2010
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2010-5-19
+GNU C Library NEWS -- history of user-visible changes.  2010-6-19
 Copyright (C) 1992-2009, 2010 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -7,7 +7,11 @@
 
 Version 2.13
 
-* POWER7 optimizations: memset
+* The following bugs are resolved with this release:
+
+  11640, 11701
+
+* POWER7 optimizations: memset, memcmp, strncmp
 
 Version 2.12
 

Modified: fsf/trunk/libc/posix/group_member.c
==============================================================================
--- fsf/trunk/libc/posix/group_member.c (original)
+++ fsf/trunk/libc/posix/group_member.c Sun Jun 20 00:03:47 2010
@@ -1,5 +1,5 @@
 /* `group_member' -- test if process is in a given group.
-   Copyright (C) 1995, 1997, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 2002, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -39,10 +39,11 @@
       groups = __alloca (size * sizeof *groups);
       n = __getgroups (size, groups);
       size *= 2;
-    } while (n == size / 2);
+    }
+  while (n == size / 2);
 
-  while (n >= 0)
-    if (groups[n--] == gid)
+  while (n-- > 0)
+    if (groups[n] == gid)
       return 1;
 
   return 0;

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c Sun Jun 20 00:03:47 2010
@@ -32,8 +32,9 @@
 char *
 getlogin (void)
 {
-  if (__getlogin_r_loginuid (name, sizeof (name)) == 0)
-    return name;
+  int res = __getlogin_r_loginuid (name, sizeof (name));
+  if (res >= 0)
+    return res == 0 ? name : NULL;
 
   return getlogin_fd0 ();
 }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c Sun Jun 20 00:03:47 2010
@@ -58,30 +58,31 @@
   bool use_malloc = false;
   struct passwd pwd;
   struct passwd *tpwd;
+  int result = 0;
   int res;
 
-  while ((res = __getpwuid_r (uid, &pwd, buf, buflen, &tpwd)) != 0)
+  while ((res = __getpwuid_r (uid, &pwd, buf, buflen, &tpwd)) == ERANGE)
     if (__libc_use_alloca (2 * buflen))
-      extend_alloca (buf, buflen, 2 * buflen);
+      buf = extend_alloca (buf, buflen, 2 * buflen);
     else
       {
 	buflen *= 2;
 	char *newp = realloc (use_malloc ? buf : NULL, buflen);
 	if (newp == NULL)
 	  {
-	  fail:
-	    if (use_malloc)
-	      free (buf);
-	    return 1;
+	    result = ENOMEM;
+	    goto out;
 	  }
 	buf = newp;
 	use_malloc = true;
       }
 
-  if (tpwd == NULL)
-    goto fail;
+  if (res != 0)
+    {
+      result = -1;
+      goto out;
+    }
 
-  int result = 0;
   size_t needed = strlen (pwd.pw_name) + 1;
   if (needed > namesize)
     {
@@ -109,8 +110,9 @@
      char *name;
      size_t namesize;
 {
-  if (__getlogin_r_loginuid (name, namesize) == 0)
-    return 0;
+  int res = __getlogin_r_loginuid (name, namesize);
+  if (res >= 0)
+    return res;
 
   return getlogin_r_fd0 (name, namesize);
 }