musl/src/misc/ptsname.c
Rich Felker c21a19d5a5 fix ptsname_r to conform to the upcoming posix requirements
it should return the error code rather than 0/-1 and setting errno.
2012-06-20 15:11:27 -04:00

16 lines
246 B
C

#include <stdlib.h>
#include <errno.h>
int __ptsname_r(int, char *, size_t);
char *ptsname(int fd)
{
static char buf[9 + sizeof(int)*3 + 1];
int err = __ptsname_r(fd, buf, sizeof buf);
if (err) {
errno = err;
return 0;
}
return buf;
}