[Libguestfs] [PATCH 61/67] launch: direct: Don't try to wait for qemu if parent process forked (RHBZ#998482).

Richard W.M. Jones rjones at redhat.com
Sat Aug 24 11:05:01 UTC 2013


From: "Richard W.M. Jones" <rjones at redhat.com>

When using guestfish --remote, libguestfs is not the parent of qemu,
so waitpid is expected to return -ECHILD.  And indeed guestfish --remote
would print a bogus error message in this case:

  libguestfs: error: waitpid (qemu): No child processes

If the parent process forked into the background, then it should have
called 'set_recovery_proc 0' so we can use this to determine if we
need to wait for qemu.

Thanks: Kazuya Saito for reporting and identifying the issue.

(cherry picked from commit a843b5e5e32c151e7b0c74bb4f7be1030f9ac85b)
---
 src/launch-direct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/launch-direct.c b/src/launch-direct.c
index ac4f7fc..f1edb53 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -1017,7 +1017,7 @@ shutdown_direct (guestfs_h *g, int check_for_errors)
   if (g->direct.recoverypid > 0) kill (g->direct.recoverypid, 9);
 
   /* Wait for subprocess(es) to exit. */
-  if (g->direct.pid > 0) {
+  if (g->recovery_proc /* RHBZ#998482 */ && g->direct.pid > 0) {
     if (waitpid (g->direct.pid, &status, 0) == -1) {
       perrorf (g, "waitpid (qemu)");
       ret = -1;
-- 
1.8.3.1




More information about the Libguestfs mailing list