virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.
Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
src/logging/log_daemon.c | 11 +++--------
src/logging/log_manager.c | 3 +--
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 3fee2b3b57..488f3b459d 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -394,8 +394,7 @@ virLogDaemonUnixSocketPaths(bool privileged,
g_autofree char *rundir = NULL;
mode_t old_umask;
- if (!(rundir = virGetUserRuntimeDirectory()))
- return -1;
+ rundir = virGetUserRuntimeDirectory();
old_umask = umask(077);
if (virFileMakePath(rundir) < 0) {
@@ -615,8 +614,7 @@ virLogDaemonExecRestartStatePath(bool privileged,
g_autofree char *rundir = NULL;
mode_t old_umask;
- if (!(rundir = virGetUserRuntimeDirectory()))
- return -1;
+ rundir = virGetUserRuntimeDirectory();
old_umask = umask(077);
if (virFileMakePath(rundir) < 0) {
@@ -992,10 +990,7 @@ int main(int argc, char **argv) {
if (privileged) {
run_dir = g_strdup(RUNSTATEDIR "/libvirt");
} else {
- if (!(run_dir = virGetUserRuntimeDirectory())) {
- VIR_ERROR(_("Can't determine user directory"));
- goto cleanup;
- }
+ run_dir = virGetUserRuntimeDirectory();
}
if (privileged)
diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c
index 7a4f036240..6b66218116 100644
--- a/src/logging/log_manager.c
+++ b/src/logging/log_manager.c
@@ -49,8 +49,7 @@ virLogManagerDaemonPath(bool privileged)
} else {
g_autofree char *rundir = NULL;
- if (!(rundir = virGetUserRuntimeDirectory()))
- return NULL;
+ rundir = virGetUserRuntimeDirectory();
path = g_strdup_printf("%s/virtlogd-sock", rundir);
}
--
2.24.1