[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [libvirt] [PATCH 2/9] openvz: Convert virExec usage to virCommand
- From: Cole Robinson <crobinso redhat com>
- To: Eric Blake <eblake redhat com>
- Cc: libvirt-list redhat com
- Subject: Re: [libvirt] [PATCH 2/9] openvz: Convert virExec usage to virCommand
- Date: Tue, 17 May 2011 10:24:15 -0400
On 05/13/2011 04:47 PM, Eric Blake wrote:
> On 05/13/2011 02:10 PM, Cole Robinson wrote:
>> v2:
>> Use virCommand's autocleanup
>>
>> Signed-off-by: Cole Robinson <crobinso redhat com>
>> ---
>> src/openvz/openvz_conf.c | 37 +++++++++--------------------
>> src/openvz/openvz_driver.c | 55 +++++++++++++++++++++++--------------------
>> 2 files changed, 41 insertions(+), 51 deletions(-)
>
>> @@ -1446,18 +1445,22 @@ static int openvzListDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
>> }
>> got ++;
>> }
>> - waitpid(pid, NULL, 0);
>> +
>> + if (virCommandWait(cmd, NULL) < 0)
>> + goto out;
>> +
>> if (VIR_CLOSE(outfd) < 0) {
>> virReportSystemError(errno, "%s", _("failed to close file"));
>> goto out;
>> }
>> - return got;
>>
>> + rc = got;
>> out:
>> VIR_FORCE_CLOSE(outfd);
>> + virCommandFree(cmd);
>> for ( ; got >= 0 ; got--)
>> VIR_FREE(names[got]);
>
> Oops, this now frees names[] on success. You need to gate this for loop
> on whether rc >= 0, now that the success path falls through to the out
> label.
>
> ACK with that nit fixed.
>
Thanks, pushed with that fix.
- Cole
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]