summaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init.c')
-rw-r--r--init.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/init.c b/init.c
index 909ee80..b952689 100644
--- a/init.c
+++ b/init.c
@@ -11,7 +11,7 @@ char *sh_args[] = { "sh", 0 };
int
main(void)
{
- int pid;
+ int pid, wpid;
if(open("console", O_RDWR) < 0){
mknod("console", T_DEV, 1, 1);
@@ -21,6 +21,7 @@ main(void)
dup(0); // stderr
for(;;){
+ puts("init: starting sh\n");
pid = fork();
if(pid < 0){
puts("init: fork failed\n");
@@ -30,8 +31,8 @@ main(void)
exec("sh", sh_args);
puts("init: exec sh failed\n");
exit();
- } else {
- wait();
}
+ while((wpid=wait()) >= 0 && wpid != pid)
+ ;
}
}