summaryrefslogtreecommitdiff
path: root/pty.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-08-29 11:52:38 +1100
committerDamien Miller <djm@mindrot.org>2000-08-29 11:52:38 +1100
commit6d8c11f627d75f5e48dfcb23c0fe9e65a7b522eb (patch)
treebfa3172cf95e9a9cff3bcbd86d41b0cdf7163711 /pty.c
parentcaf6dd6d219e916e2784b3c884a7f2ce8784df37 (diff)
- (djm) Check for SCO pty naming style (ptyp%d/ttyp%d). Based on fix from
Bastian Trompetter <btrompetter@firemail.de>
Diffstat (limited to 'pty.c')
-rw-r--r--pty.c13
1 files changed, 10 insertions, 3 deletions
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)
162 for (i = 0; i < num_ptys; i++) { 162 for (i = 0; i < num_ptys; i++) {
163 snprintf(buf, sizeof buf, "/dev/pty%c%c", ptymajors[i / num_minors], 163 snprintf(buf, sizeof buf, "/dev/pty%c%c", ptymajors[i / num_minors],
164 ptyminors[i % num_minors]); 164 ptyminors[i % num_minors]);
165 *ptyfd = open(buf, O_RDWR | O_NOCTTY);
166 if (*ptyfd < 0)
167 continue;
168 snprintf(namebuf, namebuflen, "/dev/tty%c%c", 165 snprintf(namebuf, namebuflen, "/dev/tty%c%c",
169 ptymajors[i / num_minors], ptyminors[i % num_minors]); 166 ptymajors[i / num_minors], ptyminors[i % num_minors]);
170 167
168 *ptyfd = open(buf, O_RDWR | O_NOCTTY);
169 if (*ptyfd < 0) {
170 /* Try SCO style naming */
171 snprintf(buf, sizeof buf, "/dev/ptyp%d", i);
172 snprintf(namebuf, namebuflen, "/dev/ttyp%d", i);
173 *ptyfd = open(buf, O_RDWR | O_NOCTTY);
174 if (*ptyfd < 0)
175 continue;
176 }
177
171 /* Open the slave side. */ 178 /* Open the slave side. */
172 *ttyfd = open(namebuf, O_RDWR | O_NOCTTY); 179 *ttyfd = open(namebuf, O_RDWR | O_NOCTTY);
173 if (*ttyfd < 0) { 180 if (*ttyfd < 0) {