chdir in getty
Ladislav Michl
ladis at linux-mips.org
Thu Sep 8 07:45:01 UTC 2005
Hi,
remember my troubles with mounting MTD while working directory was /dev?
(and btw, mount rewrite works nicely for me). Now I found related
problem and I'd like to ask few questions first.
Getty implementation is as well as util-linux one based on agetty.c -
"another getty program for Linux" which changes dir to /dev in open_tty:
if (chdir("/dev"))
error("/dev: chdir() failed: %m");
(Also note %m, which doesn't work in busybox) 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. Also chown(tty, 0, 0) and
chmod(tty, 0622) can be avoided when tty is already connected to std
input/output.
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?
Best regards,
ladis
More information about the busybox
mailing list