chdir in getty

Ladislav Michl ladis at linux-mips.org
Mon Sep 12 07:25:56 UTC 2005


On Fri, Sep 09, 2005 at 09:56:38PM -0500, Rob Landley wrote:
> > Now, when you choose some 
> > other login program, like /bin/sh for testing purposes, you end in /dev
> > as working directory, which is a bit unfortunate. Btw, Linux kernel does
> > sys_chdir("/root") in do_mount_root.
> 
> And then a pivot_root, I thought.

Yes, but it doesn't help you to set reasonable working directory. cwd is
/dev

> > Also chown(tty, 0, 0) and 
> > chmod(tty, 0622) can be avoided when tty is already connected to std
> > input/output.
> 
> Doesn't hurt anything, and is generic for the tty being all sorts of things 
> (serial consoles are pretty common in the embedded world).

"-" doesn't mean serial console and "can be avoided" means that if I'm
not the only one who considers setting working directory to /dev
unfortunate in can be moved inside if () for no extra cost.

> > Is there any reason for changing directory to /dev? Any objections to
> > rewrite it to use absolute path and avoid chdir when working with device
> > node?
> 
> Hmmm...  I don't know who maintains this.  The code doesn't mention who ported 
> it to busybox, and the AUTHORS file doesn't mention it at all.

util-linux uses the same code...

	ladis



More information about the busybox mailing list