X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/224c70764cab4e0e39a26aaf3ad3016552f62f55..refs/heads/master:/util/pty.c diff --git a/util/pty.c b/util/pty.c index 369ad48..1b7a3bd 100644 --- a/util/pty.c +++ b/util/pty.c @@ -69,8 +69,6 @@ #include #include -static char ptytemplate[] = "/dev/ptyXX"; - int openpty(amaster, aslave, name, termp, winp) int *amaster, *aslave; char *name; @@ -78,12 +76,12 @@ int openpty(amaster, aslave, name, termp, winp) struct winsize *winp; { int master, slave; - char *sname; + char sname[128]; if ((master = posix_openpt(O_RDWR|O_NOCTTY)) < 0) return -1; if (grantpt(master) < 0 || unlockpt(master) < 0 - || (sname = ptsname(master)) == NULL + || ptsname_r(master, sname, sizeof(sname)) == -1 || (slave = open(sname, O_RDWR|O_NOCTTY, 0)) < 0) { (void) close(master); return -1;