|
Message-Id: <20170405223218.6019-1-christian.brauner@ubuntu.com> Date: Thu, 6 Apr 2017 00:32:17 +0200 From: Christian Brauner <christian.brauner@...ntu.com> To: musl@...ts.openwall.com Cc: Christian Brauner <christian.brauner@...ntu.com> Subject: [PATCH 0/1] linux ttyname{_r}: return ENODEV not ENOENT Hi guys, After a long struggle we've recently upstreamed a patch to glibc that handles the case where a pts device might not be available even though the corresponding file desciptor refers to a terminal. The classic example is obviously mount namespaces in Linux although this can also be caused by overmounting or other scenarios. While musl correctly detects whether the pts device a given file descriptor refers to can be retrieved it returns ENOENT. We've recently upstreamed a patch to glibc which uses ENODEV. This has been after a discussion about what errno would be most in line with POSIX. Additionally we fixed a bunch of programs to handle the ENODEV case. It would be good if musl would also set ENODEV instead of ENOENT to enable programs to have uniform handle on this case and to minimize the differences between the libcs. The patch in question is: commit 15e9a4f378c8607c2ae1aa465436af4321db0e23 Author: Christian Brauner <christian.brauner@...onical.com> Date: Fri Jan 27 15:59:59 2017 +0100 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@...lyn.com> Signed-off-by: Christian Brauner <christian.brauner@...ntu.com> If possible, please Cc me on this since I'm not subscribed to the mailing list (yet). Thanks! Christian Christian Brauner (1): linux ttyname{_r}: return ENODEV not ENOENT src/unistd/ttyname_r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.