[libvirt] [PATCH 1/3] virterror: Make SetError work if no previous error was set

Daniel P. Berrange berrange at redhat.com
Thu Feb 18 12:45:37 UTC 2010


On Tue, Feb 16, 2010 at 02:37:00PM -0500, Cole Robinson wrote:
> virGetLastError returns NULL if no error has been set, not on
> allocation error like virSetError assumed. Use virLastErrorObject
> instead. This fixes virSetError when no error is currently stored.
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/util/virterror.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/virterror.c b/src/util/virterror.c
> index bbf5021..cbd0ca8 100644
> --- a/src/util/virterror.c
> +++ b/src/util/virterror.c
> @@ -304,7 +304,7 @@ int
>  virSetError(virErrorPtr newerr)
>  {
>      virErrorPtr err;
> -    err = virGetLastError();
> +    err = virLastErrorObject();
>      if (!err)
>          return -1;
>  
> -- 

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list