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

Re: [Libguestfs] [PATCH] Fix virt-v2v exit codes



On Mon, Apr 26, 2010 at 12:04:23PM +0100, Matthew Booth wrote:
>      # Make certain the child process dies with the object
>      if (defined($self->{pid})) {
>          kill(9, $self->{pid});
>          waitpid($self->{pid}, WNOHANG);
> +        $retval ||= $?;

So the non-obvious reason why this works is because waitpid returns
the child status in $?.

> +        my $retval = $?
> +
>          # Note that this undef is what actually causes the underlying handle to
>          # be closed. This is required to allow the RHEV target's temporary mount
>          # directory to be unmounted and deleted prior to exit.
>          $g = undef;
> +
> +        $? ||= $retval;

I'm a bit confused by this though.  AFAICT the Guestfs::DESTROY
function shouldn't change $?.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v


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