From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: [PATCH] kvm tool: Exit init only when /bin/sh itself stops Date: Mon, 26 Dec 2011 12:18:23 +0200 Message-ID: <1324894703-28298-1-git-send-email-levinsasha928@gmail.com> Cc: mingo@elte.hu, gorcunov@gmail.com, asias.hejun@gmail.com, kvm@vger.kernel.org, Sasha Levin To: penberg@kernel.org Return-path: Received: from mail-ey0-f174.google.com ([209.85.215.174]:41421 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754051Ab1LZKSf (ORCPT ); Mon, 26 Dec 2011 05:18:35 -0500 Received: by eaad14 with SMTP id d14so4107877eaa.19 for ; Mon, 26 Dec 2011 02:18:33 -0800 (PST) Sender: kvm-owner@vger.kernel.org List-ID: 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 --- tools/kvm/guest/init_stage2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/kvm/guest/init_stage2.c b/tools/kvm/guest/init_stage2.c index 7b96436..96bcfcd 100644 --- a/tools/kvm/guest/init_stage2.c +++ b/tools/kvm/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); -- 1.7.8.1