Unverified Commit d588de7c by Patrick Steinhardt Committed by GitHub

Merge pull request #5191 from eaigner/master

config: check if we are running in a sandboxed environment
parents ac171542 952fbbfb
......@@ -82,15 +82,25 @@ static int git_sysdir_guess_global_dirs(git_buf *out)
#else
int error;
uid_t uid, euid;
const char *sandbox_id;
uid = getuid();
euid = geteuid();
/**
* If APP_SANDBOX_CONTAINER_ID is set, we are running in a
* sandboxed environment on macOS.
*/
sandbox_id = getenv("APP_SANDBOX_CONTAINER_ID");
/*
* In case we are running setuid, use the configuration
* of the effective user.
*
* If we are running in a sandboxed environment on macOS,
* we have to get the HOME dir from the password entry file.
*/
if (uid == euid)
if (!sandbox_id && uid == euid)
error = git__getenv(out, "HOME");
else
error = get_passwd_home(out, euid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment