This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.10-373-gd94760f


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  d94760f944cebf05b239dd0b65c3b40a5577013b (commit)
      from  8d55628106730c5e318fa3673b69588509d983f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d94760f944cebf05b239dd0b65c3b40a5577013b

commit d94760f944cebf05b239dd0b65c3b40a5577013b
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Thu Oct 29 11:02:34 2009 -0700

    Fix getttyname on Linux when called for different devices.
    
    If a second call to ttyname is not for the same type of device (e.g.,
    serial vs ptty) the prefix of the buffer was wrong.  Don't rely on
    the previous content, always reinitialize it.

diff --git a/ChangeLog b/ChangeLog
index a169cee..25bb325 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
 2009-10-29  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #10784]
+	* sysdeps/unix/sysv/linux/ttyname.c (getttyname): Always copy name
+	of the directory we look at into the static buffer if there is one
+	at the start of the loop.
+
 	[BZ #10789]
 	* sysdeps/generic/netinet/ip.h: Define IPTOS_ENC* and IPTOS_DSCP*
-	macros.  Patch by  Philip Prindeville <philipp@redfish-solutions.com>.
+	macros.  Patch by Philip Prindeville <philipp@redfish-solutions.com>.
 
 	[BZ #10840]
 	* sysdeps/unix/sysv/linux/kernel-features.h: Define
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 1b79787..69af6ad 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1996-2002,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1996-2002,2006,2009 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
@@ -59,6 +59,11 @@ getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat)
       return NULL;
     }
 
+  /* Prepare for the loop.  If we already have a buffer copy the directory
+     name we look at into it.  */
+  if (devlen < namelen)
+    *((char *) __mempcpy (getttyname_name, dev, devlen - 1)) = '/';
+
   while ((d = __readdir64 (dirstream)) != NULL)
     if ((d->d_fileno == myino || *dostat)
 	&& strcmp (d->d_name, "stdin")

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                         |    7 ++++++-
 sysdeps/unix/sysv/linux/ttyname.c |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]