Script bugs with fixes
Darryl P. Wagoner
dpw at rayssd.UUCP
Sat Feb 8 02:07:03 AEST 1986
Description:
Bug 1:
Tty is in RAW mode and outruns slow terminals. Can anyone
tell me why it was in raw mode to begin with?
Bug 2:
If a remote shell dies unexpectly, (like kill -9 on the rshd)
it sometimes leaves the /dev/tty[pq][0-f] in 620 mode. This
of course depends on system configuration or the remote user
startup script.
Repeat-By:
Bug 1:
cat /etc/passwd on a terminal that will not kept up with the
baud rate of the system.
Bug 2:
As root "chmod 620 /dev/ttyp0"
% script
/dev/ttyp0: Permission denied
Script done, file is typescript
(on our Vax & Sun it just hangs there)
Terminated (on the Pyramid)
Fix:
Bug 1:
Change the RAW to CBREAK in the ioctl call.
In fixtty()
sbuf.sg_flags |= CBREAK; (new)
sbuf.sg_flags |= RAW; (old)
Bug 2:
This will cause script to skip over any protected tty[pq][0-f].
It will not change the mode of any ttys that have been abandoned.
Replace the getmaster routine with the following:
getmaster()
{
char c;
struct stat stb;
int i;
| char pline[30];
| short mode;
| for (i=0;i<=29;i++)
| pline[i]=0;
| strcpy(pline,"/dev/tty");
for (c = 'p'; c <= 's'; c++) {
line[strlen("/dev/pty")] = c;
line[strlen("/dev/ptyp")] = '0';
| pline[strlen("/dev/tty")] = c;
| pline[strlen("/dev/ttyp")] = '0';
if (stat(line, &stb) < 0)
break;
for (i = 0; i < 16; i++) {
line[strlen("/dev/ptyp")] = "0123456789abcdef"[i];
| pline[strlen("/dev/ttyp")] = "0123456789abcdef"[i];
| stat(pline,&stb);
| mode=stb.st_mode & 0666;
master = open(line, 2);
| if (master >= 0 && mode == 0666) {
ioctl(0, TIOCGETP, (char *)&b);
ioctl(0, TIOCGETC, (char *)&tc);
ioctl(0, TIOCGETD, (char *)&l);
ioctl(0, TIOCGLTC, (char *)&lc);
ioctl(0, TIOCLGET, (char *)&lb);
if ((b.sg_flags&(EVENP|ODDP))==ODDP)
parity = 0200;
else
parity = 0;
return;
}
}
}
fprintf(stderr, "Out of pty's\n");
fail();
}
--
Darryl Wagoner
Raytheon Co.; Portsmouth RI; (401)-847-8000 x4089
...!decvax!brunix!rayssd!dpw
...!allegra!rayssd!dpw
...!linus!rayssd!dpw
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list