summaryrefslogtreecommitdiffstats
path: root/builtin/var.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-09-13 19:07:57 +0200
committerJunio C Hamano <gitster@pobox.com>2023-09-13 19:07:57 +0200
commit877c9919d6175585fba9904b3c38c8156c73f965 (patch)
tree17d92412adc4a668e1b14036bf1cb8a75d04c262 /builtin/var.c
parentMerge branch 'ew/hash-with-openssl-evp' (diff)
parentvar: avoid a segmentation fault when `HOME` is unset (diff)
downloadgit-877c9919d6175585fba9904b3c38c8156c73f965.tar.xz
git-877c9919d6175585fba9904b3c38c8156c73f965.zip
Merge branch 'bc/more-git-var'
Fix-up for a topic that already has graduated. * bc/more-git-var: var: avoid a segmentation fault when `HOME` is unset
Diffstat (limited to 'builtin/var.c')
-rw-r--r--builtin/var.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/var.c b/builtin/var.c
index 74161bdf1c..8cf7dd9e2e 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -66,7 +66,7 @@ static char *git_attr_val_system(int ident_flag UNUSED)
static char *git_attr_val_global(int ident_flag UNUSED)
{
- char *file = xstrdup(git_attr_global_file());
+ char *file = xstrdup_or_null(git_attr_global_file());
if (file) {
normalize_path_copy(file, file);
return file;