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

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



On 26/04/10 13:38, Richard W.M. Jones wrote:
> 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 $?.

Yeah. That could probably do with a comment.

>> +        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 $?.

Actually I had no specific evidence that it did, I was just trying to
cover bases. Do you think this is unnecessary?

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490


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