aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-29 17:48:35 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-29 17:48:35 +0000
commit7dc7f7b215911a23deeffb9fd6f86cce39c425b6 (patch)
tree2b55e421d49cae2c529d754900f12de5f1b87ec4
parent67a969999211ebdaf0833a4fc1db2c6320d07378 (diff)
downloadglibc-7dc7f7b215911a23deeffb9fd6f86cce39c425b6.tar
glibc-7dc7f7b215911a23deeffb9fd6f86cce39c425b6.tar.gz
glibc-7dc7f7b215911a23deeffb9fd6f86cce39c425b6.tar.bz2
glibc-7dc7f7b215911a23deeffb9fd6f86cce39c425b6.zip
Update.
* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Keep Linux 2.0 kernels in mind when reading /proc/self/fd/FD. * sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Likewise.
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c4
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index dc2ad0ab97..8a622538e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
1998-10-29 Ulrich Drepper <drepper@cygnus.com>
+ * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Keep Linux 2.0
+ kernels in mind when reading /proc/self/fd/FD.
+ * sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Likewise.
+
* nscd/nscd.c (doc): It's "Name Service" not "Name Switch".
* malloc/mtrace.c (tr_where): Replace snprintf call by mempcpy and
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 40b006a8cd..35eb4b4696 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -131,7 +131,9 @@ ttyname (fd)
}
}
- if (__readlink (procname, buf, buflen) != -1)
+ if (__readlink (procname, buf, buflen) != -1
+ /* This is for Linux 2.0. */
+ && buf[0] != '[')
return buf;
if (fstat (fd, &st) < 0)
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index 8306cf56c0..449942a96d 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -134,9 +134,9 @@ __ttyname_r (fd, buf, buflen)
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
ret = __readlink (procname, buf, buflen - 1);
- if (ret != -1)
+ if (ret != -1 && buf[0] != '[')
return 0;
- if (errno == ENAMETOOLONG)
+ if (ret == -1 && errno == ENAMETOOLONG)
{
__set_errno (ERANGE);
return ERANGE;