[net.bugs.4bsd] misfeature in 4.1BSD ttyname

mjs (03/01/83)

In ttyname(), each entry in /dev is tested against the st_rdev of the
tty in question, as well as the st_ino field.  In installations which
make use of chroot logins (ala System 3 or 5), file descriptors 0, 1,
and 2 get connected to the devices in the real root, while any program
running under the subroot has access to a different filesystem for
/dev, thus preventing ttyname() (and anything that uses ttyname()) from
returning a useful answer!  The fix is simply to remove the comparison
of st_ino fields in ttyname.c.  Happy hacking!