attr: make sure we have an xdg path before using it
authorJeff King <peff@peff.net>
Tue, 24 Jul 2012 11:53:57 +0000 (07:53 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2012 15:59:07 +0000 (08:59 -0700)
commitf0c1c15c41bdcdaf71c69355ac83789466820879
tree261e34e95f83564ce0afcc737e9d9134c642289a
parent5adf84ebb375eeee998edef9a2b5aaa05df677d0
attr: make sure we have an xdg path before using it

If we don't have a core.attributesfile configured, we fall
back to checking XDG config, which is usually
$HOME/.config/git/attributes.

However, if $HOME is unset, then home_config_paths will return
NULL, and we end up calling fopen(NULL).

Depending on your system, this may or may not cause the
accompanying test to fail (e.g., on Linux and glibc, the
address will go straight to open, which will return EFAULT).
However, valgrind will reliably notice the error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c
t/t1306-xdg-files.sh