mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
secret: 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
91d88aaf23
commit
837f5619e7
@ -469,25 +469,19 @@ secretStateInitialize(bool privileged,
|
|||||||
driver->privileged = privileged;
|
driver->privileged = privileged;
|
||||||
|
|
||||||
if (privileged) {
|
if (privileged) {
|
||||||
if (virAsprintf(&driver->configDir,
|
driver->configDir = g_strdup_printf("%s/libvirt/secrets", SYSCONFDIR);
|
||||||
"%s/libvirt/secrets", SYSCONFDIR) < 0)
|
driver->stateDir = g_strdup_printf("%s/libvirt/secrets", RUNSTATEDIR);
|
||||||
goto error;
|
|
||||||
if (virAsprintf(&driver->stateDir,
|
|
||||||
"%s/libvirt/secrets", RUNSTATEDIR) < 0)
|
|
||||||
goto error;
|
|
||||||
} else {
|
} else {
|
||||||
g_autofree char *rundir = NULL;
|
g_autofree char *rundir = NULL;
|
||||||
g_autofree char *cfgdir = NULL;
|
g_autofree char *cfgdir = NULL;
|
||||||
|
|
||||||
if (!(cfgdir = virGetUserConfigDirectory()))
|
if (!(cfgdir = virGetUserConfigDirectory()))
|
||||||
goto error;
|
goto error;
|
||||||
if (virAsprintf(&driver->configDir, "%s/secrets/", cfgdir) < 0)
|
driver->configDir = g_strdup_printf("%s/secrets/", cfgdir);
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||||
goto error;
|
goto error;
|
||||||
if (virAsprintf(&driver->stateDir, "%s/secrets/run", rundir) < 0)
|
driver->stateDir = g_strdup_printf("%s/secrets/run", rundir);
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {
|
if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user