kvm tools: fix zombie reaping in guest/init.c

init.c is not very kind with processes that get reparented when
their own parent die, leaving them hanging around. Looking at the
code, it only seem to care about its own flesh and blood. Bad init.

Teach it some basic zombie reaping skills.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Marc Zyngier
2012-11-29 19:40:00 +00:00
committed by Will Deacon
parent a1166a18a9
commit 1ad95468d8
+5 -1
View File
@@ -61,7 +61,11 @@ int main(int argc, char *argv[])
else
run_process("/bin/sh");
} else {
waitpid(child, &status, 0);
pid_t corpse;
do {
corpse = waitpid(-1, &status, 0);
} while (corpse != child);
}
reboot(LINUX_REBOOT_CMD_RESTART);