aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/ttyname.c5
-rw-r--r--sysdeps/posix/ttyname_r.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/sysdeps/posix/ttyname.c b/sysdeps/posix/ttyname.c
index 6a046ea652..5ad45ae2a6 100644
--- a/sysdeps/posix/ttyname.c
+++ b/sysdeps/posix/ttyname.c
@@ -55,7 +55,10 @@ getttyname (fd, mydev, myino, save, dostat)
}
while ((d = readdir (dirstream)) != NULL)
- if ((ino_t) d->d_fileno == myino || *dostat)
+ if (((ino_t) d->d_fileno == myino || *dostat)
+ && strcmp (d->d_name, "stdin")
+ && strcmp (d->d_name, "stdout")
+ && strcmp (d->d_name, "stderr"))
{
size_t dlen = _D_ALLOC_NAMLEN (d);
if (sizeof (dev) + dlen > namelen)
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
index ad747ad35b..ae427f1aef 100644
--- a/sysdeps/posix/ttyname_r.c
+++ b/sysdeps/posix/ttyname_r.c
@@ -59,7 +59,10 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
}
while ((d = readdir (dirstream)) != NULL)
- if ((ino_t) d->d_fileno == myino || *dostat)
+ if (((ino_t) d->d_fileno == myino || *dostat)
+ && strcmp (d->d_name, "stdin")
+ && strcmp (d->d_name, "stdout")
+ && strcmp (d->d_name, "stderr"))
{
char *cp;
size_t needed = _D_EXACT_NAMLEN (d) + 1;