PTY-Allocation under SCO 5

Damien Miller djm at mindrot.org
Tue Aug 29 11:50:00 EST 2000


On Mon, 28 Aug 2000, Bastian Trompetter wrote:

> Hello,
> 
> I used the sshd under SCO 5, and always get the error that the deamon
> couldn't allcoate a pseudo tty. This depends on that SCO use a
> different method to create the tty's in the /dev directory. The pseudo
> tty line looks like: /dev/ttypXXX where XXX depends on the number of
> pseudo tty's entered in the scoadmin Tool for the network interface.

Thanks for the diagnosis. Does this patch fix things?

Index: pty.c
===================================================================
RCS file: /var/cvs/openssh/pty.c,v
retrieving revision 1.20
diff -u -r1.20 pty.c
--- pty.c	2000/06/22 11:32:31	1.20
+++ pty.c	2000/08/29 00:47:06
@@ -162,12 +162,19 @@
 	for (i = 0; i < num_ptys; i++) {
 		snprintf(buf, sizeof buf, "/dev/pty%c%c", ptymajors[i / num_minors],
 			 ptyminors[i % num_minors]);
-		*ptyfd = open(buf, O_RDWR | O_NOCTTY);
-		if (*ptyfd < 0)
-			continue;
 		snprintf(namebuf, namebuflen, "/dev/tty%c%c",
 		    ptymajors[i / num_minors], ptyminors[i % num_minors]);
 
+		*ptyfd = open(buf, O_RDWR | O_NOCTTY);
+		if (*ptyfd < 0) {
+			/* Try SCO style naming */
+			snprintf(buf, sizeof buf, "/dev/ptyp%d", i);
+			snprintf(namebuf, namebuflen, "/dev/ttyp%d", i);
+			*ptyfd = open(buf, O_RDWR | O_NOCTTY);
+			if (*ptyfd < 0)
+				continue;
+		}	
+			
 		/* Open the slave side. */
 		*ttyfd = open(namebuf, O_RDWR | O_NOCTTY);
 		if (*ttyfd < 0) {

-d

-- 
| "Bombay is 250ms from New York in the new world order" - Alan Cox
| Damien Miller - http://www.mindrot.org/
| Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)








More information about the openssh-unix-dev mailing list