This is the mail archive of the libc-alpha@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]

Re: [PATCH v2] linux ttyname and ttyname_r: do not return wrong results


On Tue, Nov 22, 2016 at 03:29:53AM +0100, Christian Brauner wrote:
> If a link (say /proc/self/fd/0) pointing to a device, say /dev/pts/2, in a
> parent mount namespace is passed to ttyname, and a /dev/pts/2 exists (in a
> different devpts) in the current namespace, then it returns /dev/pts/2. But
> /dev/pts/2 is NOT the current tty, it is a different file and device.
> 
> Detect this case and return ENODEV. Userspace can choose to take this as a hint
> that the fd points to a tty device but to act on the fd rather than the link.
> 
> Signed-off-by: Serge Hallyn <serge@hallyn.com>
> Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
> ---
> Changelog: 2016-11-08
> 	- remove obsolete comment in ttyname_r.c
> 	- move is_pty() to common header file and mark as static inline
> Changelog: 2016-11-22
> 	- remove unneeded sys/symacros.h header
> ---
>  sysdeps/unix/sysv/linux/ttyname.c   | 16 ++++++++++++----
>  sysdeps/unix/sysv/linux/ttyname.h   | 35 +++++++++++++++++++++++++++++++++++
>  sysdeps/unix/sysv/linux/ttyname_r.c | 17 +++++++++++++----
>  3 files changed, 60 insertions(+), 8 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/ttyname.h

Could you add a properly formatted GNU-style ChangeLog entry for this
change, please? (https://sourceware.org/glibc/wiki/Contribution%20checklist#Properly_Formatted_GNU_ChangeLog)

[...]
> diff --git a/sysdeps/unix/sysv/linux/ttyname.h b/sysdeps/unix/sysv/linux/ttyname.h
> new file mode 100644
> index 0000000..19af6e6
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/ttyname.h
> @@ -0,0 +1,35 @@
> +/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.

This file looks like a new one, so could you explain where does this
year range come from?

BTW, the added copyright notice means that the change is legally
significant.  If this is the case, could you explain your current
FSF copyright assignment status, please?


-- 
ldv

Attachment: pgpewFor8RlzG.pgp
Description: PGP signature


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