[BusyBox] getty and login utmp handling
Manousaridis Angelos
amanous at inaccessnetworks.com
Tue Aug 24 10:43:19 UTC 2004
I have a tmpfs temporary filesystem which is mounted at boot time.
I discovered that I was not able to umount it properly during shutdown
(or reboot) because the shell I was running had some staled open file
descriptors to the utmp and wtmp files.
I traced the problem to getty and fixed it with the following patch. The
login utility also has this problem. During the check if the u/wtmp file
exists a call to creat() is done, but the file descriptor is not used.
Right after that setutent() and updwtmp() are called which open these
files again.
You can reproduce the problem the following way:
reboot, login and:
~ # ls /proc/$$/fd -la
dr-x------ 2 root root 0 Aug 24 12:57 .
dr-xr-xr-x 3 root root 0 Aug 24 12:57 ..
lrwx------ 1 root root 64 Aug 24 12:57 0 -> /dev/console
lrwx------ 1 root root 64 Aug 24 12:57 1 -> /dev/console
lrwx------ 1 root root 64 Aug 24 12:57 10 -> /dev/tty
lrwx------ 1 root root 64 Aug 24 12:57 2 -> /dev/console
l-wx------ 1 root root 64 Aug 24 12:57 3 ->
/tmp/var-run/utmp
l-wx------ 1 root root 64 Aug 24 12:57 4 ->
/tmp/var-run/wtmp
--
Manousaridis Angelos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-1.00-rc3-10-getty.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20040824/c19f2c28/attachment.bin
More information about the busybox
mailing list