summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorPaul Betts <paul@paulbetts.org>2011-09-21 11:17:30 -0700
committerPaul Betts <paul@paulbetts.org>2011-09-21 12:00:34 -0700
commite1b86444676b70154bf8ab450d429bdef57a8276 (patch)
tree020b42f514cd78ddd44b4d38e0f57cd88f17616f /src/config.c
parente3ecf7e9ab043e44ffd94729f27e3a0c434c355a (diff)
downloadlibgit2-e1b86444676b70154bf8ab450d429bdef57a8276.tar.gz
Rewrite getenv to use Win32 version on Windows
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c
index f233e76fd..261beb425 100644
--- a/src/config.c
+++ b/src/config.c
@@ -306,20 +306,24 @@ int git_config_get_string(git_config *cfg, const char *name, const char **out)
int git_config_find_global(char *global_config_path)
{
- const char *home;
+ char *home;
- home = getenv("HOME");
+ home = p_getenv("HOME");
#ifdef GIT_WIN32
if (home == NULL)
- home = getenv("USERPROFILE");
+ home = p_getenv("USERPROFILE");
#endif
- if (home == NULL)
+ if (home == NULL) {
+ free(home);
return git__throw(GIT_EOSERR, "Failed to open global config file. Cannot locate the user's home directory");
+ }
git_path_join(global_config_path, home, GIT_CONFIG_FILENAME);
+ free(home);
+
if (git_futils_exists(global_config_path) < GIT_SUCCESS)
return git__throw(GIT_EOSERR, "Failed to open global config file. The file does not exist");