--- telnetd/sys_term.c.orig Sat Aug 2 14:37:00 1997 +++ telnetd/sys_term.c Sat Oct 17 22:11:51 1998 @@ -531,7 +531,7 @@ return(p); #else - register char c, *p1, *p2; + register char c, *p1, *p2, *cp; register int i; #if defined(__GNUC__) || defined(__sgi) @@ -548,20 +548,40 @@ p1 = &line[8]; p2 = &line[9]; #endif - - for (c = 'p'; c <= 's'; c++) { + for (cp = "pqrsPQRS"; *cp; cp++) { struct stat stb; - *p1 = c; + *p1 = *cp; *p2 = '0'; + /* + * This stat() check is just to keep us from + * looping through all 256 combinations if there + * aren't that many ptys available. + */ if (stat(line, &stb) < 0) break; - for (i = 0; i < 16; i++) { - *p2 = "0123456789abcdef"[i]; + for (i = 0; i < 32; i++) { + *p2 = "0123456789abcdefghijklmnopqrstuv"[i]; p = open(line, 2); if (p > 0) { +#ifndef __hpux line[5] = 't'; - return(p); +#else + for (p1 = &line[8]; *p1; p1++) + *p1 = *(p1+1); + line[9] = 't'; +#endif + chown(line, 0, 0); + chmod(line, 0600); +#if defined(sun) && defined(TIOCGPGRP) && BSD < 199207 + if (ioctl(p, TIOCGPGRP, &dummy) == 0 + || errno != EIO) { + chmod(line, 0666); + close(p); + line[5] = 'p'; + } else +#endif /* defined(sun) && defined(TIOCGPGRP) && BSD < 199207 */ + return(p); } } } @@ -733,11 +753,7 @@ else termbuf.lflags &= ~LPASS8; #else - if (on) { - termbuf.c_iflag &= ~ISTRIP; - } else { - termbuf.c_iflag |= ISTRIP; - } + termbuf.c_iflag &= ~ISTRIP; #endif }