If initialization of VBOX fails inside of _pfnInitialize an
negative value is returned to signal an error condition to a
caller but no error message is printed out. Reporting an error
may shed more light into why VBOX failed to initialize.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/vbox/vbox_tmpl.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 908625e702..0059a9ee3d 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -429,13 +429,18 @@ static int _pfnInitialize(struct _vboxDriver *driver)
{
nsresult rc;
- if (!(driver->pFuncs = g_pfnGetFunctions(VBOX_XPCOMC_VERSION)))
+ if (!(driver->pFuncs = g_pfnGetFunctions(VBOX_XPCOMC_VERSION))) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Unable to get pointer to VirtualBox vtable"));
return -1;
+ }
rc = driver->pFuncs->pfnClientInitialize(IVIRTUALBOXCLIENT_IID_STR,
&driver->vboxClient);
if (NS_FAILED(rc)) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Unable to initialize VirtualBox C API client"));
return -1;
} else {
driver->vboxClient->vtbl->GetVirtualBox(driver->vboxClient,
&driver->vboxObj);
--
2.45.2