virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.
Signed-off-by: Fabiano FidĂȘncio <fidencio(a)redhat.com>
---
src/locking/lock_daemon.c | 11 +++--------
src/locking/lock_driver_lockd.c | 3 +--
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 7c89adf077..65c38139c4 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -452,8 +452,7 @@ virLockDaemonUnixSocketPaths(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) {
@@ -823,8 +822,7 @@ virLockDaemonExecRestartStatePath(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) {
@@ -1224,10 +1222,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/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 8ca77e525d..339e2f6949 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -124,8 +124,7 @@ static char *virLockManagerLockDaemonPath(bool privileged)
} else {
g_autofree char *rundir = NULL;
- if (!(rundir = virGetUserRuntimeDirectory()))
- return NULL;
+ rundir = virGetUserRuntimeDirectory();
path = g_strdup_printf("%s/virtlockd-sock", rundir);
}
--
2.24.1