check the pid is > 0 before calling waitpid()
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 15 Mar 2011 11:43:02 +0000 (22:43 +1100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 15 Mar 2011 12:16:50 +0000 (12:16 +0000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
src/guestfs.c

index 8b7ab4d..4085506 100644 (file)
@@ -212,7 +212,7 @@ guestfs_close (guestfs_h *g)
   g->sock = -1;
 
   /* Wait for subprocess(es) to exit. */
-  waitpid (g->pid, NULL, 0);
+  if (g->pid > 0) waitpid (g->pid, NULL, 0);
   if (g->recoverypid > 0) waitpid (g->recoverypid, NULL, 0);
 
   /* Remove tmpfiles. */