diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/ttyname_r.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/ttyname_r.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |