[libvirt] [PATCH] openvzDomainSetNetwork: use virCommand

Eric Blake eblake at redhat.com
Mon May 20 16:10:52 UTC 2013


On 05/20/2013 02:46 AM, Ján Tomko wrote:
>> -    if (prog[0] != NULL) {
>> -        ADD_ARG_LIT("--save");
>> -        if (virRun(prog, NULL) < 0) {
>> +    if (cmd) {
> 
> cmd may be NULL here on OOM too.

That, and virCommandRun is designed to report OOM on your behalf if cmd
is NULL, so that your client code shouldn't have to worry about whether
virCommandNew... even succeeded.  Code that does 'if (cmd)' is generally
suspect as doing too much instead of letting virCommand do its job.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130520/8100169d/attachment-0001.sig>


More information about the libvir-list mailing list