[libvirt] [PATCH 1/7] hellolibvirt: Resolve Coverity issues
Eric Blake
eblake at redhat.com
Thu Jul 11 15:09:29 UTC 2013
On 07/11/2013 06:34 AM, John Ferlan wrote:
> Recent changes uncovered a NEGATIVE_RETURNS when processing 'numNames'
> in 'showDomains' in the for loop after a possible -1 return.
> ---
> examples/hellolibvirt/hellolibvirt.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c
> index 83045b1..2a48681 100644
> --- a/examples/hellolibvirt/hellolibvirt.c
> +++ b/examples/hellolibvirt/hellolibvirt.c
> @@ -90,6 +90,13 @@ showDomains(virConnectPtr conn)
> numNames = virConnectListAllDomains(conn,
> &nameList,
> flags);
> + if (numNames == -1) {
> + ret = 1;
Should we (as an independent patch) tweak this entire example file to
use EXIT_FAILURE instead of '1', to make it more obvious why we deviate
from our normal practice of negative return on failure?
--
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/20130711/248870a7/attachment-0001.sig>
More information about the libvir-list
mailing list