remove another invalid skip of locking in ungetwc
[oweals/musl.git] / src / unistd / ttyname_r.c
index 2255e2dfebb7a5c2e8378e38879792dba88476f0..8bac7b2f3ab10cb0929341ca1425af65c8d409bf 100644 (file)
@@ -1,7 +1,7 @@
 #include <unistd.h>
 #include <errno.h>
-#include <stdio.h>
-#include <string.h>
+
+void __procfdname(char *, unsigned);
 
 int ttyname_r(int fd, char *name, size_t size)
 {
@@ -10,7 +10,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;