mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
log error if virConnectCacheOnceInit() fails
virGetConnectNetwork() calls virGetConnectGeneric(), which calls virConnecCacheInitialize(), which is actually a call (only once) to virConnectCacheOnceInit() which calls virThreadLocalInit() several times, which calls pthread_key_create() If pthread_key_create() fails, it (of course) doesn't log an error (because it's not a part of libvirt), nor does any other function on the call chain all the way up to virGetConnectNetwork(). But none of the callers of virGetConnectNetwork() log an error either, so it is possible that an API could fail due to virGetConnectNetwork() failing, but would only log "an error was encountered, but the cause is unknown. Deal with it." (paraphrasing). (In all likelyhood, virConnectCacheOnceInit() is going to be called at some earlier time, and almost certainly pthread_key_create() will never fail (and if it does, the user will have *much* bigger problems than an obtuse error message from libvirt)). Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
31d1835428
commit
65ce8a424f
21
src/driver.c
21
src/driver.c
@ -116,18 +116,17 @@ virThreadLocal connectStorage;
|
|||||||
static int
|
static int
|
||||||
virConnectCacheOnceInit(void)
|
virConnectCacheOnceInit(void)
|
||||||
{
|
{
|
||||||
if (virThreadLocalInit(&connectInterface, NULL) < 0)
|
if (virThreadLocalInit(&connectInterface, NULL) < 0 ||
|
||||||
return -1;
|
virThreadLocalInit(&connectNetwork, NULL) < 0 ||
|
||||||
if (virThreadLocalInit(&connectNetwork, NULL) < 0)
|
virThreadLocalInit(&connectNWFilter, NULL) < 0 ||
|
||||||
return -1;
|
virThreadLocalInit(&connectNodeDev, NULL) < 0 ||
|
||||||
if (virThreadLocalInit(&connectNWFilter, NULL) < 0)
|
virThreadLocalInit(&connectSecret, NULL) < 0 ||
|
||||||
return -1;
|
virThreadLocalInit(&connectStorage, NULL) < 0) {
|
||||||
if (virThreadLocalInit(&connectNodeDev, NULL) < 0)
|
virReportSystemError(errno, "%s",
|
||||||
return -1;
|
_("Unable to initialize thread local variable"));
|
||||||
if (virThreadLocalInit(&connectSecret, NULL) < 0)
|
|
||||||
return -1;
|
|
||||||
if (virThreadLocalInit(&connectStorage, NULL) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user