summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2021-03-10 13:50:09 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2021-03-10 13:57:14 -0800
commit8caf10c018d77a097015798b604be8817f526274 (patch)
tree317a2a86fc169535a1d08f142233046e56e38ffc
parentdb21df4054e3351d14eb7dc1c3216cd23a61cee4 (diff)
downloadxorg-app-xinit-8caf10c018d77a097015798b604be8817f526274.tar.gz
darwin: Ensure we launch the user startx from $HOME
Fixes: https://github.com/XQuartz/XQuartz/issues/114 Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-rw-r--r--launchd/user_startx/launchd_startx.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/launchd/user_startx/launchd_startx.c b/launchd/user_startx/launchd_startx.c
index 27ce9e1..e2589be 100644
--- a/launchd/user_startx/launchd_startx.c
+++ b/launchd/user_startx/launchd_startx.c
@@ -54,6 +54,11 @@ int main(int argc, char **argv, char **envp) {
asl_log_descriptor(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
asl_log_descriptor(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
+ /* https://github.com/XQuartz/XQuartz/issues/114 */
+ char const * const home = getenv("HOME");
+ assert(home);
+ chdir(home);
+
assert(posix_spawnp(&child, argv[1], NULL, NULL, &argv[1], envp) == 0);
wait4(child, &pstat, 0, (struct rusage *)0);