提交 837f5619 编写于 作者: M Michal Privoznik

secret: Use g_strdup_printf() instead of virAsprintf()

Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
上级 91d88aaf
......@@ -469,25 +469,19 @@ secretStateInitialize(bool privileged,
driver->privileged = privileged;
if (privileged) {
if (virAsprintf(&driver->configDir,
"%s/libvirt/secrets", SYSCONFDIR) < 0)
goto error;
if (virAsprintf(&driver->stateDir,
"%s/libvirt/secrets", RUNSTATEDIR) < 0)
goto error;
driver->configDir = g_strdup_printf("%s/libvirt/secrets", SYSCONFDIR);
driver->stateDir = g_strdup_printf("%s/libvirt/secrets", RUNSTATEDIR);
} else {
g_autofree char *rundir = NULL;
g_autofree char *cfgdir = NULL;
if (!(cfgdir = virGetUserConfigDirectory()))
goto error;
if (virAsprintf(&driver->configDir, "%s/secrets/", cfgdir) < 0)
goto error;
driver->configDir = g_strdup_printf("%s/secrets/", cfgdir);
if (!(rundir = virGetUserRuntimeDirectory()))
goto error;
if (virAsprintf(&driver->stateDir, "%s/secrets/run", rundir) < 0)
goto error;
driver->stateDir = g_strdup_printf("%s/secrets/run", rundir);
}
if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册