about summary refs log tree commit diff
path: root/ChangeLog
diff options
context:
space:
mode:
authorChristian Brauner <christian.brauner@canonical.com>2017-01-27 15:59:59 +0100
committerDmitry V. Levin <ldv@altlinux.org>2017-03-19 17:36:13 +0000
commit15e9a4f378c8607c2ae1aa465436af4321db0e23 (patch)
tree021ac3c62fe588a8745fcdf09d29392a837759e0 /ChangeLog
parent345118d7f5bc42c8d4c3a8ef70b9b709fa57e93d (diff)
downloadglibc-15e9a4f378c8607c2ae1aa465436af4321db0e23.tar.gz
glibc-15e9a4f378c8607c2ae1aa465436af4321db0e23.tar.xz
glibc-15e9a4f378c8607c2ae1aa465436af4321db0e23.zip
linux ttyname and ttyname_r: do not return wrong results
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@ubuntu.com>
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog12
1 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ce823aec0f..e732c7d46b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-03-19  Christian Brauner  <christian.brauner@ubuntu.com>
+
+	* sysdeps/unix/sysv/linux/ttyname.h: New file.
+	* sysdeps/unix/sysv/linux/ttyname.c: Include "ttyname.h".
+	(ttyname) [!_STATBUF_ST_RDEV]: Make code unconditional.
+	Call is_pty when the link does not exist or does not match, fail
+	with ENODEV when it returns true.
+	* sysdeps/unix/sysv/linux/ttyname_r.c: Include "ttyname.h".
+	(__ttyname_r) [!_STATBUF_ST_RDEV]: Make code unconditional.
+	Call is_pty when the link does not exist or does not match, fail
+	with ENODEV when it returns true.
+
 2017-03-18  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #16437]