summaryrefslogtreecommitdiff
path: root/src/unistd
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd')
-rw-r--r--src/unistd/ttyname_r.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/unistd/ttyname_r.c b/src/unistd/ttyname_r.c
index 2255e2df..a2ce3511 100644
--- a/src/unistd/ttyname_r.c
+++ b/src/unistd/ttyname_r.c
@@ -3,6 +3,8 @@
#include <stdio.h>
#include <string.h>
+void __procfdname(char *, unsigned);
+
int ttyname_r(int fd, char *name, size_t size)
{
char procname[sizeof "/proc/self/fd/" + 3*sizeof(int) + 2];
@@ -10,7 +12,7 @@ int ttyname_r(int fd, char *name, size_t size)
if (!isatty(fd)) return ENOTTY;
- snprintf(procname, sizeof procname, "/proc/self/fd/%d", fd);
+ __procfdname(procname, fd);
l = readlink(procname, name, size);
if (l < 0) return errno;