On Wed, Aug 27, 2008 at 05:00:36PM +0000, Miod Vallat wrote:
> > >chroot $r /bin/sh
> > >tty
> > >not a tty
> > >
> > >Where I am going wrong?
> >
> > I'll bet $r is on a filesystem mounted with the nosuid option.
>
> Err, I meant nodev here, of course. And this should work even if
> /var/run/dev.db is missing, though...
>
> Miod
Well, if you are making new inodes for the devices in the chroot env,
this test in libc/gen/ttyname.c:oldttyname() will always execute the
continue statement.
if (dirp->d_fileno != sb->st_ino)
continue;
So in absense of dev.db, the function ttyname() will fail if the
actual device node that is the controlling tty is not the same as the
ones which oldttyname() scans.
-Otto