]>
Commit | Line | Data |
---|---|---|
bb330e25 AF |
1 | commit 050af9c4e86eeecd484ed44b7765e750523276eb |
2 | Author: Siddhesh Poyarekar <siddhesh@redhat.com> | |
3 | Date: Wed Aug 29 10:03:39 2012 +0530 | |
4 | ||
5 | Don't make ttyname* fail if proc filesystem is not available | |
6 | ||
7 | The ttyname and ttyname_r functions on Linux now fall back to | |
8 | searching for the tty file descriptor in /dev/pts or /dev if /proc is | |
9 | not available. This allows creation of chroots without the procfs | |
10 | mounted on /proc. | |
11 | ||
12 | Fixes BZ #14516. | |
13 | ||
14 | 2012-08-29 Siddhesh Poyarekar <siddhesh@redhat.com> | |
15 | ||
16 | [BZ #14516] | |
17 | * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Don't return | |
18 | failure if reading from procfs failed. | |
19 | * sysdeps/unix/sysv/linux/ttyname_r.c (ttyname_r): Likewise. | |
20 | ||
21 | diff -rup a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c | |
22 | --- a/sysdeps/unix/sysv/linux/ttyname.c 2010-05-04 05:27:23.000000000 -0600 | |
23 | +++ b/sysdeps/unix/sysv/linux/ttyname.c 2012-08-27 10:53:29.326671475 -0600 | |
24 | @@ -146,12 +146,6 @@ ttyname (int fd) | |
25 | } | |
26 | ||
27 | ssize_t len = __readlink (procname, ttyname_buf, buflen); | |
28 | - if (__builtin_expect (len == -1 && errno == ENOENT, 0)) | |
29 | - { | |
30 | - __set_errno (EBADF); | |
31 | - return NULL; | |
32 | - } | |
33 | - | |
34 | if (__builtin_expect (len != -1 | |
35 | #ifndef __ASSUME_PROC_SELF_FD_SYMLINK | |
36 | /* This is for Linux 2.0. */ | |
37 | diff -rup a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c | |
38 | --- a/sysdeps/unix/sysv/linux/ttyname_r.c 2010-05-04 05:27:23.000000000 -0600 | |
39 | +++ b/sysdeps/unix/sysv/linux/ttyname_r.c 2012-08-27 10:54:05.406528501 -0600 | |
40 | @@ -126,12 +126,6 @@ __ttyname_r (int fd, char *buf, size_t b | |
41 | *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0'; | |
42 | ||
43 | ssize_t ret = __readlink (procname, buf, buflen - 1); | |
44 | - if (__builtin_expect (ret == -1 && errno == ENOENT, 0)) | |
45 | - { | |
46 | - __set_errno (EBADF); | |
47 | - return EBADF; | |
48 | - } | |
49 | - | |
50 | if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0)) | |
51 | { | |
52 | __set_errno (ERANGE); |