[libvirt] [libvirt-glib 2/2] conn-test: Fix gvir_connection_get_version error check
Michal Privoznik
mprivozn at redhat.com
Wed Nov 14 14:45:49 UTC 2012
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
More information about the libvir-list
mailing list