[libvirt] [PATCH] fix some bugs of sheepdog storage driver

Daniel P. Berrange berrange at redhat.com
Fri Feb 8 11:11:50 UTC 2013


On Fri, Feb 08, 2013 at 06:49:47PM +0800, harryxiyou at gmail.com wrote:
> Don't try to do other jobs if get cmd NULL.
> 
> Signed-off-by: Harry Wei <harryxiyou at gmail.com>
> 
> ---
>  src/storage/storage_backend_sheepdog.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
> index 218284d..1ce5aa4 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, the virCommand APIs are designed explicitly so that you do *not*
need to check for NULL in this way. This page has a description of the
usage of virCommand APIs

http://libvirt.org/internals/command.html#initial


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list