[libvirt] [PATCH 12/24] maint: improve VIR_ERR_INVALID_DOMAIN usage

Eric Blake eblake at redhat.com
Tue Jan 7 21:47:49 UTC 2014


On 01/02/2014 04:47 PM, John Ferlan wrote:
> 
> 
> On 12/28/2013 11:11 AM, Eric Blake wrote:
>> In datatype.c, virGetDomainSnapshot could result in the message:
>>
>> error: invalid domain pointer in bad domain
>>
>> Furthermore, while there are a few functions in libvirt.c that
>> only care about a virDomainPtr without regards to the connection
>> (such as virDomainGetName), most functions also require a valid
>> connection.  Yet several functions were blindly derefencing the

I'll fix that typo while at it.

>> After this patch, all places that validate a domain consistently
>> report:
>>
>> error: invalid domain pointer in someFunc
>>
>> * src/datatypes.h (virCheckDomainReturn, virCheckDomainGoto): New
>> macros.
>> * src/datatypes.c (virGetDomainSnapshot): Use new macro.
>> (virLibConnError): Delete unused macro.
>>
>> Signed-off-by: Eric Blake <eblake at redhat.com>
>> ---
>>  po/POTFILES.in     |    1 -
>>  src/datatypes.c    |   18 +-
>>  src/datatypes.h    |   23 ++
>>  src/libvirt-lxc.c  |   11 +-
>>  src/libvirt-qemu.c |   18 +-
>>  src/libvirt.c      | 1055 +++++++++++++---------------------------------------
>>  6 files changed, 284 insertions(+), 842 deletions(-)
>>
> 
> ACK
> 
> I was going to point out a couple patches ago about the usage of
> domain->conn->flags in a call followed by a conn = domain->conn and then
> usage of conn-> afterwards, but figured it'd be cleared up soon
> enough... It was! :-)

Now pushed.

-- 
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: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140107/5ab640d5/attachment-0001.sig>


More information about the libvir-list mailing list