提交 102c7505 编写于 作者: D Daniel P. Berrange

Fix misc bugs in qemu connection opening

上级 f30b84f9
Thu Mar 8 10:14:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_internal.c: Fix inverted check on file handle to
avoid opening connection twice. Avoid SEGV if uri->scheme is
NULL. Don't run autostart for system instance.
Thu Mar 8 09:47:24 EST 2007 Daniel P. Berrange <berrange@redhat.com> Thu Mar 8 09:47:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/libvirt.c: Refactored driver registration to avoid * src/libvirt.c: Refactored driver registration to avoid
......
...@@ -329,6 +329,7 @@ static int qemuProcessRequest(virConnectPtr conn, ...@@ -329,6 +329,7 @@ static int qemuProcessRequest(virConnectPtr conn,
*/ */
static int qemuOpenConnection(virConnectPtr conn, xmlURIPtr uri, int readonly) { static int qemuOpenConnection(virConnectPtr conn, xmlURIPtr uri, int readonly) {
char path[PATH_MAX]; char path[PATH_MAX];
int autostart = 0;
if (uri->server != NULL) { if (uri->server != NULL) {
return -1; return -1;
...@@ -358,8 +359,9 @@ static int qemuOpenConnection(virConnectPtr conn, xmlURIPtr uri, int readonly) { ...@@ -358,8 +359,9 @@ static int qemuOpenConnection(virConnectPtr conn, xmlURIPtr uri, int readonly) {
if (snprintf(path, sizeof(path), "@%s/.libvirt/qemud-sock", pw->pw_dir) == sizeof(path)) { if (snprintf(path, sizeof(path), "@%s/.libvirt/qemud-sock", pw->pw_dir) == sizeof(path)) {
return -1; return -1;
} }
autostart = 1;
} }
return qemuOpenClientUNIX(conn, path, 1); return qemuOpenClientUNIX(conn, path, autostart);
} }
...@@ -845,13 +847,13 @@ static int qemuNetworkOpen(virConnectPtr conn, ...@@ -845,13 +847,13 @@ static int qemuNetworkOpen(virConnectPtr conn,
xmlURIPtr uri = NULL; xmlURIPtr uri = NULL;
int ret = -1; int ret = -1;
if (conn->qemud_fd == -1) if (conn->qemud_fd != -1)
return 0; return 0;
if (name) if (name)
uri = xmlParseURI(name); uri = xmlParseURI(name);
if (uri && !strcmp(uri->scheme, "qemu")) if (uri && uri->scheme && !strcmp(uri->scheme, "qemu"))
ret = qemuOpen(conn, name, flags); ret = qemuOpen(conn, name, flags);
else if (geteuid() == 0) else if (geteuid() == 0)
ret = qemuOpen(conn, "qemu:///system", flags); ret = qemuOpen(conn, "qemu:///system", flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册