diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-01-29 12:47:53 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-29 12:47:54 -0800 |
commit | 773e4088819cb17150afd4929f32bccabb8e2acd (patch) | |
tree | 16a345c12e869466049d0c6641b783c32ed84c83 /environment.c | |
parent | 15b07cba0b60f0fc5dea0be0d68a355a8161476d (diff) | |
parent | 0da0e9268b4825cafb27bb0e07b43fae30bb33da (diff) | |
download | git-773e4088819cb17150afd4929f32bccabb8e2acd.tar.gz |
Merge branch 'jk/save-getenv-result'
There were many places the code relied on the string returned from
getenv() to be non-volatile, which is not true, that have been
corrected.
* jk/save-getenv-result:
builtin_diff(): read $GIT_DIFF_OPTS closer to use
merge-recursive: copy $GITHEAD strings
init: make a copy of $GIT_DIR string
config: make a copy of $GIT_CONFIG string
commit: copy saved getenv() result
get_super_prefix(): copy getenv() result
Diffstat (limited to 'environment.c')
-rw-r--r-- | environment.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/environment.c b/environment.c index 0e37741d83..89af47cb85 100644 --- a/environment.c +++ b/environment.c @@ -107,7 +107,7 @@ char *git_work_tree_cfg; static char *git_namespace; -static const char *super_prefix; +static char *super_prefix; /* * Repository-local GIT_* environment variables; see cache.h for details. @@ -240,7 +240,7 @@ const char *get_super_prefix(void) { static int initialized; if (!initialized) { - super_prefix = getenv(GIT_SUPER_PREFIX_ENVIRONMENT); + super_prefix = xstrdup_or_null(getenv(GIT_SUPER_PREFIX_ENVIRONMENT)); initialized = 1; } return super_prefix; |