mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
logging: Use g_autofree in virLogDaemonExecRestartStatePath()
Together with the change, let's also simplify the function and get rid of the goto. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
441c668b82
commit
0753ddb48a
@ -612,29 +612,23 @@ virLogDaemonExecRestartStatePath(bool privileged,
|
||||
if (privileged) {
|
||||
*state_file = g_strdup(RUNSTATEDIR "/virtlogd-restart-exec.json");
|
||||
} else {
|
||||
char *rundir = NULL;
|
||||
g_autofree char *rundir = NULL;
|
||||
mode_t old_umask;
|
||||
|
||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||
goto error;
|
||||
return -1;
|
||||
|
||||
old_umask = umask(077);
|
||||
if (virFileMakePath(rundir) < 0) {
|
||||
umask(old_umask);
|
||||
VIR_FREE(rundir);
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
umask(old_umask);
|
||||
|
||||
*state_file = g_strdup_printf("%s/virtlogd-restart-exec.json", rundir);
|
||||
|
||||
VIR_FREE(rundir);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user