From 5e048c182ed48dc67de7fadbb0ae23dcd30397e5 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 26 Dec 2011 12:18:23 +0200 Subject: [PATCH] kvm tool: Exit init only when /bin/sh itself stops Right now we wait for any of the children to stop, which means we might exit before /bin/sh stopped. Instead, wait only for the /bin/sh (or the sandboxed) process. Signed-off-by: Sasha Levin Signed-off-by: Pekka Enberg --- guest/init_stage2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guest/init_stage2.c b/guest/init_stage2.c index 7b96436..96bcfcd 100644 --- a/guest/init_stage2.c +++ b/guest/init_stage2.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) else run_process("/bin/sh"); } else { - wait(&status); + waitpid(child, &status, 0); } reboot(LINUX_REBOOT_CMD_RESTART);