Skip to contentSkip to conversation

kvm tool: Exit init only when /bin/sh itself stops

PATCH New Sasha Levin 1 participant 1 message Dec 26, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tools/kvm/guest/init_stage2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/kvm/guest/init_stage2.c +1 -1
index 7b96436..96bcfcd 100644
@@ -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);
Signature · 1 line
1.7.8.1