aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2012-08-29 10:03:39 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2012-08-29 10:04:23 +0530
commit050af9c4e86eeecd484ed44b7765e750523276eb (patch)
tree0f0db2f1ddbadd2288acc5540eb9684337c78815 /sysdeps/unix
parentad845c0be95fe3635af0147f0665b110286e68a5 (diff)
downloadglibc-050af9c4e86eeecd484ed44b7765e750523276eb.tar
glibc-050af9c4e86eeecd484ed44b7765e750523276eb.tar.gz
glibc-050af9c4e86eeecd484ed44b7765e750523276eb.tar.bz2
glibc-050af9c4e86eeecd484ed44b7765e750523276eb.zip
Don't make ttyname* fail if proc filesystem is not available
The ttyname and ttyname_r functions on Linux now fall back to searching for the tty file descriptor in /dev/pts or /dev if /proc is not available. This allows creation of chroots without the procfs mounted on /proc. Fixes BZ #14516.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c6
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c6
2 files changed, 0 insertions, 12 deletions
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 3dacd40c23..d3070c3ba8 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -148,12 +148,6 @@ ttyname (int fd)
}
ssize_t len = __readlink (procname, ttyname_buf, buflen);
- if (__builtin_expect (len == -1 && errno == ENOENT, 0))
- {
- __set_errno (EBADF);
- return NULL;
- }
-
if (__builtin_expect (len != -1, 1))
{
if ((size_t) len >= buflen)
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index 2dd6781348..211ed189bb 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -128,12 +128,6 @@ __ttyname_r (int fd, char *buf, size_t buflen)
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
ssize_t ret = __readlink (procname, buf, buflen - 1);
- if (__builtin_expect (ret == -1 && errno == ENOENT, 0))
- {
- __set_errno (EBADF);
- return EBADF;
- }
-
if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0))
{
__set_errno (ERANGE);