[PATCH] API: Share code between virConnectOpen functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eduardo Lima (Etrunko) <eblima@xxxxxxxxxx>

Signed-off-by: Eduardo Lima (Etrunko) <eblima@xxxxxxxxxx>
---
 src/libvirt.c |   30 ++----------------------------
 1 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 68074e7..ca7a9a2 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1341,20 +1341,7 @@ failed:
 virConnectPtr
 virConnectOpen (const char *name)
 {
-    virConnectPtr ret = NULL;
-    if (!initialized)
-        if (virInitialize() < 0)
-            goto error;
-
-    VIR_DEBUG("name=%s", name);
-    ret = do_open (name, NULL, 0);
-    if (!ret)
-        goto error;
-    return ret;
-
-error:
-    virDispatchError(NULL);
-    return NULL;
+    return virConnectOpenAuth(name, NULL, 0);
 }
 
 /**
@@ -1375,20 +1362,7 @@ error:
 virConnectPtr
 virConnectOpenReadOnly(const char *name)
 {
-    virConnectPtr ret = NULL;
-    if (!initialized)
-        if (virInitialize() < 0)
-            goto error;
-
-    VIR_DEBUG("name=%s", name);
-    ret = do_open (name, NULL, VIR_CONNECT_RO);
-    if (!ret)
-        goto error;
-    return ret;
-
-error:
-    virDispatchError(NULL);
-    return NULL;
+    return virConnectOpenAuth(name, NULL, VIR_CONNECT_RO);
 }
 
 /**
-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]