From 94c98eb5509de291892bd5b410bccb9b5dce8955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Sun, 20 Oct 2019 12:41:35 +0200 Subject: [PATCH] drivers: use g_strdup in probe functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The callers expect '1' on a successful probe, so return 1 just like VIR_STRDUP would. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- 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; }