summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/ttyname_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/ttyname_r.c')
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index 2dd6781348..259d727a54 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -96,10 +96,13 @@ getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino,
int
__ttyname_r (int fd, char *buf, size_t buflen)
{
+#ifndef __ASSUME_PROC_SELF_FD_NOT_SYMLINK
char procname[30];
+#endif
struct stat64 st, st1;
int dostat = 0;
int save = errno;
+ ssize_t ret;
/* Test for the absolute minimal size. This makes life easier inside
the loop. */
@@ -149,6 +152,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
memmove (buf, buf + UNREACHABLE_LEN, ret - UNREACHABLE_LEN);
ret -= UNREACHABLE_LEN;
}
+#endif /* __ASSUME_PROC_SELF_FD_NOT_SYMLINK */
/* readlink need not terminate the string. */
buf[ret] = '\0';