Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/remote/remote_daemon.c | 28 ++++++++++++++--------------
src/remote/remote_daemon_config.c | 2 +-
src/remote/remote_daemon_dispatch.c | 14 +++++++-------
src/remote/remote_driver.c | 12 ++++++------
4 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 6977cc36e0..56e1455a1a 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -225,23 +225,23 @@ daemonUnixSocketPaths(struct daemonConfig *config,
char *rundir = NULL;
if (config->unix_sock_dir) {
- virAsprintf(sockfile, "%s/%s-sock", config->unix_sock_dir,
- SOCK_PREFIX);
+ *sockfile = g_strdup_printf("%s/%s-sock", config->unix_sock_dir,
+ SOCK_PREFIX);
if (privileged) {
- virAsprintf(rosockfile, "%s/%s-sock-ro",
- config->unix_sock_dir, SOCK_PREFIX);
- virAsprintf(admsockfile, "%s/%s-admin-sock",
- config->unix_sock_dir, SOCK_PREFIX);
+ *rosockfile = g_strdup_printf("%s/%s-sock-ro",
+ config->unix_sock_dir, SOCK_PREFIX);
+ *admsockfile = g_strdup_printf("%s/%s-admin-sock",
+ config->unix_sock_dir, SOCK_PREFIX);
}
} else {
if (privileged) {
- virAsprintf(sockfile, "%s/libvirt/%s-sock",
- RUNSTATEDIR, SOCK_PREFIX);
- virAsprintf(rosockfile, "%s/libvirt/%s-sock-ro",
- RUNSTATEDIR, SOCK_PREFIX);
- virAsprintf(admsockfile, "%s/libvirt/%s-admin-sock",
- RUNSTATEDIR, SOCK_PREFIX);
+ *sockfile = g_strdup_printf("%s/libvirt/%s-sock",
+ RUNSTATEDIR, SOCK_PREFIX);
+ *rosockfile = g_strdup_printf("%s/libvirt/%s-sock-ro",
+ RUNSTATEDIR, SOCK_PREFIX);
+ *admsockfile = g_strdup_printf("%s/libvirt/%s-admin-sock",
+ RUNSTATEDIR, SOCK_PREFIX);
} else {
mode_t old_umask;
@@ -255,8 +255,8 @@ daemonUnixSocketPaths(struct daemonConfig *config,
}
umask(old_umask);
- virAsprintf(sockfile, "%s/%s-sock", rundir, SOCK_PREFIX);
- virAsprintf(admsockfile, "%s/%s-admin-sock", rundir, SOCK_PREFIX);
+ *sockfile = g_strdup_printf("%s/%s-sock", rundir, SOCK_PREFIX);
+ *admsockfile = g_strdup_printf("%s/%s-admin-sock", rundir,
SOCK_PREFIX);
}
}
diff --git a/src/remote/remote_daemon_config.c b/src/remote/remote_daemon_config.c
index cfc0869747..ae6b491686 100644
--- a/src/remote/remote_daemon_config.c
+++ b/src/remote/remote_daemon_config.c
@@ -84,7 +84,7 @@ daemonConfigFilePath(bool privileged, char **configfile)
if (!(configdir = virGetUserConfigDirectory()))
goto error;
- virAsprintf(configfile, "%s/%s.conf", configdir, DAEMON_NAME);
+ *configfile = g_strdup_printf("%s/%s.conf", configdir, DAEMON_NAME);
VIR_FREE(configdir);
}
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index d12c3c1ed9..a443cb174b 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -2174,7 +2174,7 @@ remoteDispatchProbeURI(bool readonly,
g_autofree char *daemonname = NULL;
g_autofree char *daemonpath = NULL;
- virAsprintf(&daemonname, "virt%sd", drivers[i]);
+ daemonname = g_strdup_printf("virt%sd", drivers[i]);
if (!(daemonpath = virFileFindResource(daemonname, "src",
SBINDIR)))
return -1;
@@ -2184,7 +2184,7 @@ remoteDispatchProbeURI(bool readonly,
continue;
}
- virAsprintf(probeduri, "%s:///session", drivers[i]);
+ *probeduri = g_strdup_printf("%s:///session", drivers[i]);
VIR_DEBUG("Probed URI %s via daemon %s", *probeduri, daemonpath);
return 0;
@@ -2217,15 +2217,15 @@ remoteDispatchProbeURI(bool readonly,
for (i = 0; i < (ssize_t) G_N_ELEMENTS(drivers) && !*probeduri; i++)
{
g_autofree char *sockname = NULL;
- virAsprintf(&sockname, "%s/libvirt/virt%sd-%s", RUNSTATEDIR,
- drivers[i], readonly ? "sock-ro" : "sock");
+ sockname = g_strdup_printf("%s/libvirt/virt%sd-%s", RUNSTATEDIR,
+ drivers[i], readonly ? "sock-ro" :
"sock");
if (!virFileExists(sockname)) {
VIR_DEBUG("Missing sock %s for driver %s", sockname,
drivers[i]);
continue;
}
- virAsprintf(probeduri, "%s:///system", drivers[i]);
+ *probeduri = g_strdup_printf("%s:///system", drivers[i]);
VIR_DEBUG("Probed URI %s via sock %s", *probeduri, sockname);
return 0;
@@ -3839,8 +3839,8 @@ remoteDispatchAuthList(virNetServerPtr server,
virResetLastError();
} else if (callerUid == 0) {
char *ident;
- virAsprintf(&ident, "pid:%lld,uid:%d", (long long)callerPid,
- (int)callerUid);
+ ident = g_strdup_printf("pid:%lld,uid:%d", (long long)callerPid,
+ (int)callerUid);
VIR_INFO("Bypass polkit auth for privileged client %s", ident);
virNetServerSetClientAuthenticated(server, client);
auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 4fcf13161c..2872b67469 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -781,7 +781,7 @@ remoteGetUNIXSocketHelper(remoteDriverTransport transport,
if (!(userdir = virGetUserRuntimeDirectory()))
return NULL;
- virAsprintf(&sockname, "%s/%s-sock", userdir, sock_prefix);
+ sockname = g_strdup_printf("%s/%s-sock", userdir, sock_prefix);
} else {
/* Intentionally do *NOT* use RUNSTATEDIR here. We might
* be connecting to a remote machine, and cannot assume
@@ -789,9 +789,9 @@ remoteGetUNIXSocketHelper(remoteDriverTransport transport,
* any machine with /run will have a /var/run symlink.
* The portable option is to thus use $LOCALSTATEDIR/run
*/
- virAsprintf(&sockname, "%s/run/libvirt/%s-%s", LOCALSTATEDIR,
- sock_prefix,
- flags & VIR_DRV_OPEN_REMOTE_RO ? "sock-ro" :
"sock");
+ sockname = g_strdup_printf("%s/run/libvirt/%s-%s", LOCALSTATEDIR,
+ sock_prefix,
+ flags & VIR_DRV_OPEN_REMOTE_RO ?
"sock-ro" : "sock");
}
VIR_DEBUG("Built UNIX sockname %s for transport %s prefix %s flags=0x%x",
@@ -815,7 +815,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
g_autofree char *legacy_sock_name = NULL;
if (driver)
- virAsprintf(&direct_daemon, "virt%sd", driver);
+ direct_daemon = g_strdup_printf("virt%sd", driver);
legacy_daemon = g_strdup("libvirtd");
@@ -998,7 +998,7 @@ doRemoteOpen(virConnectPtr conn,
/* Remote server defaults to "localhost" if not specified. */
if (conn->uri && conn->uri->port != 0) {
- virAsprintf(&port, "%d", conn->uri->port);
+ port = g_strdup_printf("%d", conn->uri->port);
} else if (transport == REMOTE_DRIVER_TRANSPORT_TLS) {
port = g_strdup(LIBVIRTD_TLS_PORT);
} else if (transport == REMOTE_DRIVER_TRANSPORT_TCP) {
--
2.21.0