misfeature in 4.1BSD ttyname()
utzoo!decvax!harpo!eagle!mhuxt!mhuxa!mhb5c!mhb5b!mjs
utzoo!decvax!harpo!eagle!mhuxt!mhuxa!mhb5c!mhb5b!mjs
Tue Mar 1 10:21:24 AEST 1983
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!
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list