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

Re: [libvirt] [PATCH RFC] helper of copy-storage-* features



On 10/21/2012 08:09 PM, Doug Goldstein wrote:
> On Sun, Oct 21, 2012 at 7:53 PM, liguang <lig fnst cn fujitsu com> wrote:
>> help to create disk images copy-storage-* required,
>> try to do non-shared migration without bothering to
>> create disk images at target by hand.
>>

>> +        } else
>> +            cmd = virCommandNewArgList("rm", "-f", def->disks[i]->src, NULL);
>> +
>> +        if (virCommandRun(cmd, NULL) < 0) {
>> +            goto cleanup;
>> +            virReportSystemError(errno, "%s",
>> +            _("unable create disk images by qemu-img"));
>> +        }
> 
> The error message reported doesn't match what happened when the rm -f
> fails. Also 'cmd' is being leaked here.

Not to mention virCommandRun() is overkill.  Use unlink() here instead,
rather than forking out to an external program.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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