blob: a34779276fa011be935e1db0860d775165ba8729 [file] [log] [blame]
Rich Felker750b7382011-04-13 08:35:32 -04001#include <stdlib.h>
Rich Felkerc21a19d2012-06-20 15:11:27 -04002#include <errno.h>
Rich Felker750b7382011-04-13 08:35:32 -04003
4int __ptsname_r(int, char *, size_t);
5
6char *ptsname(int fd)
7{
8 static char buf[9 + sizeof(int)*3 + 1];
Rich Felkerc21a19d2012-06-20 15:11:27 -04009 int err = __ptsname_r(fd, buf, sizeof buf);
10 if (err) {
11 errno = err;
12 return 0;
13 }
14 return buf;
Rich Felker750b7382011-04-13 08:35:32 -040015}