aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-07-29 06:33:12 +0000
committerEric Andersen <andersen@codepoet.org>2003-07-29 06:33:12 +0000
commit9cdef5d9286839a0b787c25f41633508f8623765 (patch)
tree8305ff483e1c1348bb0436b176b63ec4cf53916e
parent930c59675a6d9976f62578d2cd469190701b8616 (diff)
downloadbusybox-w32-9cdef5d9286839a0b787c25f41633508f8623765.tar.gz
busybox-w32-9cdef5d9286839a0b787c25f41633508f8623765.tar.bz2
busybox-w32-9cdef5d9286839a0b787c25f41633508f8623765.zip
Yang Xiaopeng writes:
>I'm sure that no user process use old root now, but when run "umount >/old_root", it says: > umount: /old_root: Device or resource busy > >I have tried to remount /proc within the new root *after* chroot, but >get the same result. > > I found the problem, I said that no user process use old root when run my scripts, but I'm wrong, actually there is a '3' fd open the file "/old_root/dev/console". By adding debug message in init/init.c, I found the problem: when init restart(in exec_signal()), before open the new terminal device, there is still a file opened(I don't know which file it is), so the terminal device(stdin) get fd '1', and the first dup(0)(stdout) return '2', the second(stderr) return '3'. I attach a simple patch to solve this problem.
-rw-r--r--init/init.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/init/init.c b/init/init.c
index 7e24eacdd..1ecc43e16 100644
--- a/init/init.c
+++ b/init/init.c
@@ -735,6 +735,11 @@ static void exec_signal(int sig)
735 sigaddset(&unblock_signals, SIGTSTP); 735 sigaddset(&unblock_signals, SIGTSTP);
736 sigprocmask(SIG_UNBLOCK, &unblock_signals, NULL); 736 sigprocmask(SIG_UNBLOCK, &unblock_signals, NULL);
737 737
738 /* Close whatever files are open. */
739 close(0);
740 close(1);
741 close(2);
742
738 /* Open the new terminal device */ 743 /* Open the new terminal device */
739 if ((device_open(a->terminal, O_RDWR)) < 0) { 744 if ((device_open(a->terminal, O_RDWR)) < 0) {
740 if (stat(a->terminal, &sb) != 0) { 745 if (stat(a->terminal, &sb) != 0) {