mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
Propagate virConnectOpen errors to global error object
This commit is contained in:
parent
c2bbf99e48
commit
11a2e2972a
@ -1,3 +1,8 @@
|
|||||||
|
Wed Aug 21 11:09:09 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* src/libvirt.c: Propagate error from virConnect to global
|
||||||
|
error object for virConnectOpen() failures
|
||||||
|
|
||||||
Wed Aug 21 10:28:09 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
Wed Aug 21 10:28:09 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* libvirt.spec.in: Add libvirt_lxc to spec file and conditionals
|
* libvirt.spec.in: Add libvirt_lxc to spec file and conditionals
|
||||||
|
@ -744,10 +744,8 @@ do_open (const char *name,
|
|||||||
name = "xen:///";
|
name = "xen:///";
|
||||||
|
|
||||||
ret = virGetConnect();
|
ret = virGetConnect();
|
||||||
if (ret == NULL) {
|
if (ret == NULL)
|
||||||
virLibConnError(NULL, VIR_ERR_NO_MEMORY, _("allocating connection"));
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
uri = xmlParseURI (name);
|
uri = xmlParseURI (name);
|
||||||
if (!uri) {
|
if (!uri) {
|
||||||
@ -848,7 +846,21 @@ do_open (const char *name,
|
|||||||
failed:
|
failed:
|
||||||
if (ret->driver) ret->driver->close (ret);
|
if (ret->driver) ret->driver->close (ret);
|
||||||
if (uri) xmlFreeURI(uri);
|
if (uri) xmlFreeURI(uri);
|
||||||
virUnrefConnect(ret);
|
|
||||||
|
/* If not global error was set, copy any error set
|
||||||
|
in the connection object we're about to dispose of */
|
||||||
|
if (__lastErr.code == VIR_ERR_OK) {
|
||||||
|
memcpy(&__lastErr, &ret->err, sizeof(ret->err));
|
||||||
|
memset(&ret->err, 0, sizeof(ret->err));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Still no error set, then raise a generic error */
|
||||||
|
if (__lastErr.code == VIR_ERR_OK)
|
||||||
|
virLibConnError (NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("unable to open connection"));
|
||||||
|
|
||||||
|
virUnrefConnect(ret);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user