From 6d8c11f627d75f5e48dfcb23c0fe9e65a7b522eb Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 29 Aug 2000 11:52:38 +1100 Subject: - (djm) Check for SCO pty naming style (ptyp%d/ttyp%d). Based on fix from Bastian Trompetter --- pty.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'pty.c') diff --git a/pty.c b/pty.c index a6c238bd9..f5bb86124 100644 --- a/pty.c +++ b/pty.c @@ -162,12 +162,19 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) 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) { -- cgit v1.2.3