[libvirt] [PATCH] Fix error return value for VirCommandNewArgList

Eric Blake eblake at redhat.com
Thu Apr 11 14:39:42 UTC 2013


On 04/11/2013 08:35 AM, harryxiyou at gmail.com wrote:
> From: Harry Wei <harryxiyou at gmail.com>
> 
> virCommandNewArgList may return NULL so we need not
> do following stuffs and just return '-1'.
> 
> Signed-off-by: Harry Wei <harryxiyou at gmail.com>
> CC: Osier Yang <jyang at redhat.com>
> CC: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/storage/storage_backend_sheepdog.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
> index 35a3a04..3452eaa 100644
> --- a/src/storage/storage_backend_sheepdog.c
> +++ b/src/storage/storage_backend_sheepdog.c
> @@ -120,6 +120,8 @@ virStorageBackendSheepdogRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
>      virCommandPtr cmd;
>  
>      cmd = virCommandNewArgList(COLLIE, "node", "info", "-r", NULL);
> +    if (cmd == NULL)
> +        return -1;

NACK.  virCommand is explicitly designed to allow NULL input on all
intermediate commands, and finally report the error at virCommandRun()
time, without burdening the caller with intermediate error checking.

-- 
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/20130411/f6800717/attachment-0001.sig>


More information about the libvir-list mailing list