about summary refs log tree commit diff
path: root/sysdeps/generic/pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/pty.c')
-rw-r--r--sysdeps/generic/pty.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sysdeps/generic/pty.c b/sysdeps/generic/pty.c
index 660602b25a..75c7857f47 100644
--- a/sysdeps/generic/pty.c
+++ b/sysdeps/generic/pty.c
@@ -49,6 +49,10 @@ static char sccsid[] = "@(#)pty.c	8.1 (Berkeley) 6/4/93";
 #include <pty.h>
 #include <utmp.h>
 
+#ifndef REVOKE
+# define REVOKE(Line) revoke (Line)
+#endif
+
 int
 openpty(amaster, aslave, name, termp, winp)
 	int *amaster, *aslave;
@@ -56,7 +60,7 @@ openpty(amaster, aslave, name, termp, winp)
 	struct termios *termp;
 	struct winsize *winp;
 {
-	static char line[] = "/dev/ptyXX";
+	char line[11];
 	register const char *cp1, *cp2;
 	register int master, slave, ttygid;
 	size_t buflen = sysconf (_SC_GETGR_R_SIZE_MAX);
@@ -64,6 +68,8 @@ openpty(amaster, aslave, name, termp, winp)
 	struct group grbuffer;
 	struct group *gr;
 
+	strcpy (line, "/dev/ptyXX");
+
 	if (getgrnam_r("tty", &grbuffer, buffer, buflen, &gr) >= 0)
 		ttygid = gr->gr_gid;
 	else
@@ -80,7 +86,7 @@ openpty(amaster, aslave, name, termp, winp)
 				line[5] = 't';
 				(void) chown(line, getuid(), ttygid);
 				(void) chmod(line, S_IRUSR|S_IWUSR|S_IWGRP);
-				(void) revoke(line);
+				REVOKE(line);
 				if ((slave = open(line, O_RDWR, 0)) != -1) {
 					*amaster = master;
 					*aslave = slave;