[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] check the pid is > 0 before calling waitpid()



On Mon, Mar 14, 2011 at 11:46:21AM +0000, Richard W.M. Jones wrote:
> On Mon, Mar 14, 2011 at 10:40:12PM +1100, Angus Salkeld wrote:
> > Signed-off-by: Angus Salkeld <asalkeld redhat com>
> > ---
> >  src/launch.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/src/launch.c b/src/launch.c
> > index e50985d..8de2857 100644
> > --- a/src/launch.c
> > +++ b/src/launch.c
> > @@ -769,7 +769,7 @@ launch_appliance (guestfs_h *g)
> >    }
> >    if (g->pid > 0) kill (g->pid, 9);
> >    if (g->recoverypid > 0) kill (g->recoverypid, 9);
> > -  waitpid (g->pid, NULL, 0);
> > +  if (g->pid > 0) waitpid (g->pid, NULL, 0);
> >    if (g->recoverypid > 0) waitpid (g->recoverypid, NULL, 0);
> >    g->fd[0] = -1;
> >    g->fd[1] = -1;
> > -- 
> > 1.7.4.1
> 
> ACK.  I'll push this in a moment.
> 
> Note that for any changes that you would like added to the RHEL 6.2
> package, you must file a bug:
> https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Red%20Hat%20Enterprise%20Linux%206
> 
I finally managed to build and test this. I missed a simerlar change in src/guestfs.c
So we need another little patch (attached).

-Angus

> Rich.
> 
> -- 
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> libguestfs lets you edit virtual machines.  Supports shell scripting,
> bindings from many languages.  http://libguestfs.org
>From ea44b9bb9dcb0dcf3f3a37d20e25233c07aabb05 Mon Sep 17 00:00:00 2001
From: Angus Salkeld <asalkeld redhat com>
Date: Tue, 15 Mar 2011 22:43:02 +1100
Subject: [PATCH] check the pid is > 0 before calling waitpid()

Signed-off-by: Angus Salkeld <asalkeld redhat com>
---
 src/guestfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/guestfs.c b/src/guestfs.c
index 8b7ab4d..4085506 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -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. */
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]