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

[commits] r10336 - in /fsf/trunk/libc: ChangeLog sysdeps/unix/bsd/ptsname.c sysdeps/unix/getlogin.c



Author: eglibc
Date: Thu Apr 29 00:03:48 2010
New Revision: 10336

Log:
Import glibc-mainline for 2010-04-29

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/sysdeps/unix/bsd/ptsname.c
    fsf/trunk/libc/sysdeps/unix/getlogin.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Apr 29 00:03:48 2010
@@ -1,4 +1,9 @@
 2010-04-25  Bruno Haible  <bruno@xxxxxxxxx>
+
+	[BZ #11538]
+	* sysdeps/unix/bsd/ptsname.c (__ptsname_r): Use __ttyname_r's return
+	value instead of errno.
+	* sysdeps/unix/getlogin.c (getlogin): Likewise.
 
 	[BZ #11537]
 	* sysdeps/mach/hurd/ttyname_r.c (__ttyname_r): Upon failure, return

Modified: fsf/trunk/libc/sysdeps/unix/bsd/ptsname.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/bsd/ptsname.c (original)
+++ fsf/trunk/libc/sysdeps/unix/bsd/ptsname.c Thu Apr 29 00:03:48 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998,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
@@ -44,6 +44,7 @@
 __ptsname_r (int fd, char *buf, size_t buflen)
 {
   int save_errno = errno;
+  int err;
   struct stat st;
 
   if (buf == NULL)
@@ -62,8 +63,12 @@
       return ERANGE;
     }
 
-  if (__ttyname_r (fd, buf, buflen) != 0)
-    return errno;
+  err = __ttyname_r (fd, buf, buflen);
+  if (err != 0)
+    {
+      __set_errno (err);
+      return errno;
+    }
 
   buf[sizeof (_PATH_DEV) - 1] = 't';
 

Modified: fsf/trunk/libc/sysdeps/unix/getlogin.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/getlogin.c (original)
+++ fsf/trunk/libc/sysdeps/unix/getlogin.c Thu Apr 29 00:03:48 2010
@@ -38,6 +38,7 @@
 {
   char tty_pathname[2 + 2 * NAME_MAX];
   char *real_tty_path = tty_pathname;
+  int err;
   char *result = NULL;
   struct utmp *ut, line, buffer;
 
@@ -50,8 +51,12 @@
      thing to do.  Note that ttyname(open("/dev/tty")) on those
      systems returns /dev/tty, so that is not a possible solution for
      getlogin().  */
-  if (__ttyname_r (0, real_tty_path, sizeof (tty_pathname)) != 0)
-    return NULL;
+  err = __ttyname_r (0, real_tty_path, sizeof (tty_pathname));
+  if (err != 0)
+    {
+      __set_errno (err);
+      return NULL;
+    }
 
   real_tty_path += 5;		/* Remove "/dev/".  */