refactor git_getpass into generic prompt function
[gitweb.git] / config.c
index edf9914df6a1a789780c98d53b7b779908bb9141..b6d789a189713a0259e3f8eb0e29ef657cde66c7 100644 (file)
--- a/config.c
+++ b/config.c
@@ -865,12 +865,12 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
 
        home = getenv("HOME");
        if (home) {
-               char *user_config = xstrdup(mkpath("%s/.gitconfig", home));
+               char buf[PATH_MAX];
+               char *user_config = mksnpath(buf, sizeof(buf), "%s/.gitconfig", home);
                if (!access(user_config, R_OK)) {
                        ret += git_config_from_file(fn, user_config, data);
                        found += 1;
                }
-               free(user_config);
        }
 
        if (repo_config && !access(repo_config, R_OK)) {