From: Matthias Bolte Date: Thu, 14 Jul 2011 14:58:43 +0000 (+0200) Subject: xenapi: Improve error reporting in xenapiOpen X-Git-Tag: v0.9.4-rc1~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2682731d24e9e93aa815e3e3e97bd4b75fac4ae0;p=thirdparty%2Flibvirt.git xenapi: Improve error reporting in xenapiOpen Use better suited error code and avoid NULL in error messsage as *privP->session->error_description can be NULL. --- diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index aa616cab2b..98838e69ee 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -106,7 +106,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, } if (conn->uri->server == NULL) { - xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED, + xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG, _("Server name not in URI")); goto error; } @@ -194,7 +194,9 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, } xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED, - *privP->session->error_description); + *privP->session->error_description != NULL ? + *privP->session->error_description : + _("unknown error")); error: VIR_FREE(username);