[libvirt] [PATCH] 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. --- src/xenapi/xenapi_driver.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index aa616ca..98838e6 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); -- 1.7.4.1

On 07/14/2011 08:59 AM, Matthias Bolte wrote:
Use better suited error code and avoid NULL in error messsage as *privP->session->error_description can be NULL. --- src/xenapi/xenapi_driver.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2011/7/14 Eric Blake <eblake@redhat.com>:
On 07/14/2011 08:59 AM, Matthias Bolte wrote:
Use better suited error code and avoid NULL in error messsage as *privP->session->error_description can be NULL. --- src/xenapi/xenapi_driver.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
ACK.
Thanks, pushed. -- Matthias Bolte http://photron.blogspot.com
participants (2)
-
Eric Blake
-
Matthias Bolte