[libvirt] [PATCH 06/34] drivers: use g_strdup in probe functions

Ján Tomko jtomko at redhat.com
Sun Oct 20 12:55:24 UTC 2019


The callers expect '1' on a successful probe,
so return 1 just like VIR_STRDUP would.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/bhyve/bhyve_driver.c   | 3 ++-
 src/libxl/libxl_driver.c   | 3 ++-
 src/lxc/lxc_driver.c       | 3 ++-
 src/openvz/openvz_driver.c | 3 ++-
 src/vbox/vbox_common.c     | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 52e1895052..db3d71f2b2 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -185,7 +185,8 @@ bhyveConnectURIProbe(char **uri)
     if (bhyve_driver == NULL)
         return 0;
 
-    return VIR_STRDUP(*uri, "bhyve:///system");
+    *uri = g_strdup("bhyve:///system");
+    return 1;
 }
 
 
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 14bd62b383..eaa35481ed 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -855,7 +855,8 @@ libxlConnectURIProbe(char **uri)
     if (libxl_driver == NULL)
         return 0;
 
-    return VIR_STRDUP(*uri, "xen:///system");
+    *uri = g_strdup("xen:///system");
+    return 1;
 }
 
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 7c2e6cf561..65d17aba8e 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -128,7 +128,8 @@ lxcConnectURIProbe(char **uri)
     if (lxc_driver == NULL)
         return 0;
 
-    return VIR_STRDUP(*uri, "lxc:///system");
+    *uri = g_strdup("lxc:///system");
+    return 1;
 }
 
 
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index d1153edd00..bf399986a7 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1317,7 +1317,8 @@ openvzConnectURIProbe(char **uri)
     if (access("/proc/vz", W_OK) < 0)
         return 0;
 
-    return VIR_STRDUP(*uri, "openvz:///system");
+    *uri = g_strdup("openvz:///system");
+    return 1;
 }
 
 
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 02c0a894e7..94a79bde64 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -502,7 +502,8 @@ vboxAttachStorageControllers(virDomainDefPtr def,
 static int
 vboxConnectURIProbe(char **uri)
 {
-    return VIR_STRDUP(*uri, geteuid() ? "vbox:///session" : "vbox:///system");
+    *uri = g_strdup(geteuid() ? "vbox:///session" : "vbox:///system");
+    return 1;
 }
 
 
-- 
2.21.0




More information about the libvir-list mailing list