summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-08 11:24:13 -0800
committerJunio C Hamano <gitster@pobox.com>2010-12-08 11:24:13 -0800
commit09a8fbd59cb18c222db732e053c17583f7f06840 (patch)
tree768fbfe0d097a84b0ffd93fca6fde059153f877c /environment.c
parentc3f7d51bdafe6f87f38aaa355b2153bb78afc821 (diff)
parent15431ca651050ba315fa4e2e74527f6d115e706c (diff)
downloadgit-09a8fbd59cb18c222db732e053c17583f7f06840.tar.gz
Merge branch 'ks/maint-getenv-fix'
* ks/maint-getenv-fix: setup: make sure git_dir path is in a permanent buffer, getenv(3) case
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/environment.c b/environment.c
index 913b0580af..c79f2a9b56 100644
--- a/environment.c
+++ b/environment.c
@@ -88,6 +88,7 @@ const char * const local_repo_env[LOCAL_REPO_ENV_SIZE + 1] = {
static void setup_git_env(void)
{
git_dir = getenv(GIT_DIR_ENVIRONMENT);
+ git_dir = git_dir ? xstrdup(git_dir) : NULL;
if (!git_dir) {
git_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
git_dir = git_dir ? xstrdup(git_dir) : NULL;