void-packages/srcpkgs/turnstile/patches/fix-chdir.patch

26 lines
933 B
Diff

From 00fd0b1ad7b5fd262bb83c75cb463ad32b1940c9 Mon Sep 17 00:00:00 2001
From: q66 <q66@chimera-linux.org>
Date: Wed, 29 Nov 2023 14:39:16 +0100
Subject: [PATCH] exec_utils: fix operand for homedir chdir
Using OR would result in the second operand running on success
of the first so typically all the user services ended up starting
in / by default.
---
src/exec_utils.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/exec_utils.cc b/src/exec_utils.cc
index aab57ba..c48f833 100644
--- a/src/exec_utils.cc
+++ b/src/exec_utils.cc
@@ -353,7 +353,7 @@ void srv_child(login &lgn, char const *backend, bool make_rundir) {
return;
}
/* change directory to home, fall back to / or error */
- if ((chdir(lgn.homedir.data()) < 0) || (chdir("/") < 0)) {
+ if ((chdir(lgn.homedir.data()) < 0) && (chdir("/") < 0)) {
perror("srv: failed to change directory");
return;
}