diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-04-13 08:35:32 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-04-13 08:35:32 -0400 |
commit | 750b738e53f799443fcfcd3a0751318c072a022f (patch) | |
tree | ccce946913f6e5bfef0512fdd2313fd512ef1d3c /src/misc/ptsname.c | |
parent | e2915eeeea244d3818d5eb7532ed35c6cf43c8fd (diff) | |
download | musl-750b738e53f799443fcfcd3a0751318c072a022f.tar.gz musl-750b738e53f799443fcfcd3a0751318c072a022f.tar.xz musl-750b738e53f799443fcfcd3a0751318c072a022f.zip |
add ptsname_r (nonstandard) and split ptsname (standard) to separate file
this eliminates the ugly static buffer in programs that use ptsname_r.
Diffstat (limited to 'src/misc/ptsname.c')
-rw-r--r-- | src/misc/ptsname.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/misc/ptsname.c b/src/misc/ptsname.c new file mode 100644 index 00000000..4f56781d --- /dev/null +++ b/src/misc/ptsname.c @@ -0,0 +1,9 @@ +#include <stdlib.h> + +int __ptsname_r(int, char *, size_t); + +char *ptsname(int fd) +{ + static char buf[9 + sizeof(int)*3 + 1]; + return __ptsname_r(fd, buf, sizeof buf) < 0 ? 0 : buf; +} |