[libvirt] [PATCH] vbox: Fix logic in storage driver open function

Matthias Bolte matthias.bolte at googlemail.com
Thu Jul 7 07:24:47 UTC 2011


If the main driver is the vbox driver, then the open function
has to return an error if the private data is invalid.
---
 src/vbox/vbox_tmpl.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 37fe248..dfa676e 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -7753,19 +7753,16 @@ static virDrvOpenStatus vboxStorageOpen (virConnectPtr conn,
     vboxGlobalData *data = conn->privateData;
 
     if (STRNEQ(conn->driver->name, "VBOX"))
-        goto cleanup;
+        return VIR_DRV_OPEN_DECLINED;
 
     if ((data->pFuncs      == NULL) ||
         (data->vboxObj     == NULL) ||
         (data->vboxSession == NULL))
-        goto cleanup;
+        return VIR_DRV_OPEN_ERROR;
 
     VIR_DEBUG("vbox storage initialized");
     /* conn->storagePrivateData = some storage specific data */
     return VIR_DRV_OPEN_SUCCESS;
-
-cleanup:
-    return VIR_DRV_OPEN_DECLINED;
 }
 
 static int vboxStorageClose (virConnectPtr conn) {
-- 
1.7.4.1




More information about the libvir-list mailing list