mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
vmware: 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:
parent
24d213b03c
commit
adca67448e
@ -275,18 +275,15 @@ vmwareExtractVersion(struct vmware_driver *driver)
|
||||
|
||||
switch (driver->type) {
|
||||
case VMWARE_DRIVER_PLAYER:
|
||||
if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmplayer") < 0)
|
||||
goto cleanup;
|
||||
bin = g_strdup_printf("%s/%s", vmwarePath, "vmplayer");
|
||||
break;
|
||||
|
||||
case VMWARE_DRIVER_WORKSTATION:
|
||||
if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmware") < 0)
|
||||
goto cleanup;
|
||||
bin = g_strdup_printf("%s/%s", vmwarePath, "vmware");
|
||||
break;
|
||||
|
||||
case VMWARE_DRIVER_FUSION:
|
||||
if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmware-vmx") < 0)
|
||||
goto cleanup;
|
||||
bin = g_strdup_printf("%s/%s", vmwarePath, "vmware-vmx");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -365,19 +362,13 @@ vmwareParsePath(const char *path, char **directory, char **filename)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
vmwareConstructVmxPath(char *directoryName, char *name, char **vmxPath)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (directoryName != NULL)
|
||||
ret = virAsprintf(vmxPath, "%s/%s.vmx", directoryName, name);
|
||||
*vmxPath = g_strdup_printf("%s/%s.vmx", directoryName, name);
|
||||
else
|
||||
ret = virAsprintf(vmxPath, "%s.vmx", name);
|
||||
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
*vmxPath = g_strdup_printf("%s.vmx", name);
|
||||
}
|
||||
|
||||
int
|
||||
@ -437,8 +428,7 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath) < 0)
|
||||
goto cleanup;
|
||||
vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath);
|
||||
|
||||
ret = 0;
|
||||
|
||||
@ -477,8 +467,7 @@ vmwareMoveFile(char *srcFile, char *dstFile)
|
||||
int
|
||||
vmwareMakePath(char *srcDir, char *srcName, char *srcExt, char **outpath)
|
||||
{
|
||||
if (virAsprintf(outpath, "%s/%s.%s", srcDir, srcName, srcExt) < 0)
|
||||
return -1;
|
||||
*outpath = g_strdup_printf("%s/%s.%s", srcDir, srcName, srcExt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -495,9 +484,7 @@ vmwareExtractPid(const char * vmxPath)
|
||||
if ((vmxDir = mdir_name(vmxPath)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (virAsprintf(&logFilePath, "%s/vmware.log",
|
||||
vmxDir) < 0)
|
||||
goto cleanup;
|
||||
logFilePath = g_strdup_printf("%s/vmware.log", vmxDir);
|
||||
|
||||
if ((logFile = fopen(logFilePath, "r")) == NULL)
|
||||
goto cleanup;
|
||||
|
@ -71,8 +71,8 @@ int vmwareParseVersionStr(int type, const char *buf, unsigned long *version);
|
||||
|
||||
int vmwareDomainConfigDisplay(vmwareDomainPtr domain, virDomainDefPtr vmdef);
|
||||
|
||||
int vmwareConstructVmxPath(char *directoryName, char *name,
|
||||
char **vmxPath);
|
||||
void vmwareConstructVmxPath(char *directoryName, char *name,
|
||||
char **vmxPath);
|
||||
|
||||
int vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user