Loading...
--- Libc/Libc-1244.20.1/stdlib/grantpt.c
+++ Libc/Libc-583/stdlib/grantpt.c
@@ -62,15 +62,11 @@
char *
ptsname(int fd)
{
- static char *ptsnamebuf = NULL;
+ static char ptsnamebuf[ 128]; /* ioctl knows length */
int error;
char *retval = NULL;
struct stat sbuf;
- if (ptsnamebuf == NULL) {
- ptsnamebuf = malloc(128); // defined by TIOCPTYGNAME
- }
-
error = ioctl(fd, TIOCPTYGNAME, ptsnamebuf);
if (!error) {
/*
@@ -79,9 +75,8 @@
* POSIX: Handle device rename test case, which is expected
* to fail if the pty has been renamed.
*/
- if (stat(ptsnamebuf, &sbuf) == 0) {
+ if (stat(ptsnamebuf, &sbuf) == 0)
retval = ptsnamebuf;
- }
}
return (retval);