kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: penberg@kernel.org
Cc: mingo@elte.hu, gorcunov@gmail.com, asias.hejun@gmail.com,
	kvm@vger.kernel.org, Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH] kvm tool: Exit init only when /bin/sh itself stops
Date: Mon, 26 Dec 2011 12:18:23 +0200	[thread overview]
Message-ID: <1324894703-28298-1-git-send-email-levinsasha928@gmail.com> (raw)

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 <levinsasha928@gmail.com>
---
 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


                 reply	other threads:[~2011-12-26 10:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324894703-28298-1-git-send-email-levinsasha928@gmail.com \
    --to=levinsasha928@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).