* 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.
This commit is contained in:
Ulrich Drepper 1998-10-29 17:48:35 +00:00
parent 67a9699992
commit 7dc7f7b215
3 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;