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

[commits] r10783 - in /fsf/trunk/libc: ChangeLog sysdeps/unix/sysv/linux/getlogin_r.c



Author: eglibc
Date: Tue Jun 22 00:03:36 2010
New Revision: 10783

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

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Jun 22 00:03:36 2010
@@ -1,3 +1,8 @@
+2010-06-21  Andreas Schwab <schwab@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
+	Restore proper fallback handling.
+
 2010-06-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #11701]

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 Tue Jun 22 00:03:36 2010
@@ -27,6 +27,10 @@
 #undef getlogin_r
 
 
+/* Try to determine login name from /proc/self/loginuid and return 0
+   if successful.  If /proc/self/loginuid cannot be read return -1.
+   Otherwise return the error number.  */
+
 int
 attribute_hidden
 __getlogin_r_loginuid (name, namesize)
@@ -35,7 +39,7 @@
 {
   int fd = open_not_cancel_2 ("/proc/self/loginuid", O_RDONLY);
   if (fd == -1)
-    return 1;
+    return -1;
 
   /* We are reading a 32-bit number.  12 bytes are enough for the text
      representation.  If not, something is wrong.  */
@@ -51,7 +55,7 @@
       || (uidbuf[n] = '\0',
 	  uid = strtoul (uidbuf, &endp, 10),
 	  endp == uidbuf || *endp != '\0'))
-    return 1;
+    return -1;
 
   size_t buflen = 1024;
   char *buf = alloca (buflen);