ack/plat/pdpv7/libsys
George Koehler 5db312a1c0 Prevent crash in isatty()
The existing code allocated 2 bytes (char*), but gtty() needs 6 bytes
(struct sgttyb), so isatty() smashed the stack and corrupted its
return address, probably causing SIGBUS or SIGSEGV.

Fix by switching to TIOCGETD, which needs 2 bytes.  TIOCGETD isn't in
the manual for tty(4), but does appear in
https://minnie.tuhs.org//cgi-bin/utree.pl?file=V7/usr/sys/dev/tty.c

This fixes hilo_c.pdpv7 and hilo_mod.pdpv7 in simh-pdp11.
2018-06-15 00:48:29 -04:00
..
_alarm.s
_close.s
_creat.s
_dup.s
_execl.s
_exit.s
_fork.s
_fstat.s
_ftime.s
_getpid.s
_gtty.c
_ioctl.s
_kill.s
_link.s
_lseek.s
_open.s
_pause.s
_pipe.s
_read.s
_sbrk.s
_unlink.s
_wait.s
_write.s
access.s
acct.s
alarm.s
build.lua
chdir.s
chmod.s
chown.s
chroot.s
cleanup.c
close.s
creat.s
dup.s
errno.s
execl.s
execle.s
execv.s
execve.s
exit.c
fetchi.s
fork.s
fperr.s
fstat.s
ftime.s
getgid.s
getgrp.s
getpid.s
getppid.s
getuid.s
gldav.s
gtty.c
ioctl.s
isatty.c
kill.s
killbkg.s
killpg.s
link.s
lock.s
login.s
lseek.s
lstat.s
mknod.s
mount.s
mpxcall.s
nice.s
nostk.s
open.s
pause.s
phys.s
pipe.s
profil.s
ptrace.s
qfstat.s
qstat.s
quota.s
read.s
readlink.s
reboot.s
renice.s
rtp.s
sbrk.s
setgid.s
setgrp.s
setuid.s
signal.s
stat.s
stime.s
stty.c
submit.s
symlink.s
sync.s
sys.h
time.s
times.s
ucall.s
umask.s
umount.s
unlink.s
utime.s
vfork.s
vhangup.s
wait.s
write.s