[libvirt] [PATCH 02/19] Set conn->driver before running driver connectOpen method
Daniel P. Berrange
berrange at redhat.com
Wed Jun 19 17:00:43 UTC 2013
From: "Daniel P. Berrange" <berrange at redhat.com>
The access control checks in the 'connectOpen' driver method
will require 'conn->driver' to be non-NULL. Set this before
running the 'connectOpen' method and NULL-ify it again on
failure.
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
src/libvirt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index b467679..8e8f415 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1201,6 +1201,7 @@ do_open(const char *name,
}
VIR_DEBUG("trying driver %d (%s) ...", i, virDriverTab[i]->name);
+ ret->driver = virDriverTab[i];
res = virDriverTab[i]->connectOpen(ret, auth, flags);
VIR_DEBUG("driver %d %s returned %s",
i, virDriverTab[i]->name,
@@ -1209,10 +1210,12 @@ do_open(const char *name,
(res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status")));
if (res == VIR_DRV_OPEN_SUCCESS) {
- ret->driver = virDriverTab[i];
break;
} else if (res == VIR_DRV_OPEN_ERROR) {
+ ret->driver = NULL;
goto failed;
+ } else {
+ ret->driver = NULL;
}
}
--
1.8.1.4
More information about the libvir-list
mailing list