Re: [libvirt-glib 2/2] conn-test: Fix gvir_connection_get_version error check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14.11.2012 15:16, Christophe Fergeau wrote:
> This method returns a version number, which can be 0, so we cannot
> check the return value for 0 to know if an error happened. Test if
> the GError is set instead to detect errors.
> ---
>  examples/conn-test.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/conn-test.c b/examples/conn-test.c
> index b98d115..3e0e148 100644
> --- a/examples/conn-test.c
> +++ b/examples/conn-test.c
> @@ -47,7 +47,8 @@ do_connection_open(GObject *source,
>  
>      g_print("Hypervisor name: %s\n", hv_name);
>  
> -    if (!(hv_version = gvir_connection_get_version(conn, &err))) {
> +    hv_version = gvir_connection_get_version(conn, &err);
> +    if (err != NULL) {
>          g_error("%s", err->message);
>      }
>  
> 

ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]