From 8caf10c018d77a097015798b604be8817f526274 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Wed, 10 Mar 2021 13:50:09 -0800 Subject: darwin: Ensure we launch the user startx from $HOME Fixes: https://github.com/XQuartz/XQuartz/issues/114 Signed-off-by: Jeremy Huddleston Sequoia --- launchd/user_startx/launchd_startx.c | 5 +++++ 1 file changed, 5 insertions(+) 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); -- cgit v1.2.3