Together with the change, let's also simplify the function and get rid
of the goto.
Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
src/logging/log_daemon.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 268d3c62b9..d41d9caba9 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -391,29 +391,23 @@ virLogDaemonUnixSocketPaths(bool privileged,
*sockfile = g_strdup(RUNSTATEDIR "/libvirt/virtlogd-sock");
*adminSockfile = g_strdup(RUNSTATEDIR "/libvirt/virtlogd-admin-sock");
} 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);
*sockfile = g_strdup_printf("%s/virtlogd-sock", rundir);
*adminSockfile = g_strdup_printf("%s/virtlogd-admin-sock", rundir);
-
- VIR_FREE(rundir);
}
return 0;
-
- error:
- return -1;
}
--
2.24.1