phyp: Use g_strdup_printf() instead of virAsprintf()

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Michal Privoznik 2019-10-22 15:26:14 +02:00
parent e5caed83bd
commit 183a60aa75

View File

@ -500,9 +500,8 @@ phypUUIDTable_Push(virConnectPtr conn)
char *remote_file = NULL; char *remote_file = NULL;
int ret = -1; int ret = -1;
if (virAsprintf(&remote_file, "/home/%s/libvirt_uuid_table", remote_file = g_strdup_printf("/home/%s/libvirt_uuid_table",
NULLSTR(conn->uri->user)) < 0) NULLSTR(conn->uri->user));
goto cleanup;
if (stat(local_file, &local_fileinfo) == -1) { if (stat(local_file, &local_fileinfo) == -1) {
VIR_WARN("Unable to stat local file."); VIR_WARN("Unable to stat local file.");
@ -688,9 +687,8 @@ phypUUIDTable_Pull(virConnectPtr conn)
char *remote_file = NULL; char *remote_file = NULL;
int ret = -1; int ret = -1;
if (virAsprintf(&remote_file, "/home/%s/libvirt_uuid_table", remote_file = g_strdup_printf("/home/%s/libvirt_uuid_table",
NULLSTR(conn->uri->user)) < 0) NULLSTR(conn->uri->user));
goto cleanup;
/* Trying to stat the remote file. */ /* Trying to stat the remote file. */
do { do {
@ -935,11 +933,9 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
if (userhome == NULL) if (userhome == NULL)
goto err; goto err;
if (virAsprintf(&pubkey, "%s/.ssh/id_rsa.pub", userhome) < 0) pubkey = g_strdup_printf("%s/.ssh/id_rsa.pub", userhome);
goto err;
if (virAsprintf(&pvtkey, "%s/.ssh/id_rsa", userhome) < 0) pvtkey = g_strdup_printf("%s/.ssh/id_rsa", userhome);
goto err;
if (conn->uri->user != NULL) { if (conn->uri->user != NULL) {
username = g_strdup(conn->uri->user); username = g_strdup(conn->uri->user);
@ -2277,8 +2273,7 @@ phypStorageVolGetPath(virStorageVolPtr vol)
if (!pv) if (!pv)
goto cleanup; goto cleanup;
if (virAsprintf(&path, "/%s/%s/%s", pv, ret, vol->name) < 0) path = g_strdup_printf("/%s/%s/%s", pv, ret, vol->name);
goto cleanup;
cleanup: cleanup:
VIR_FREE(ret); VIR_FREE(ret);