summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/config.c b/config.c
index f9c400ad30..f33abeab85 100644
--- a/config.c
+++ b/config.c
@@ -1833,9 +1833,10 @@ static int git_config_from_blob_ref(config_fn_t fn,
char *git_system_config(void)
{
char *system_config = xstrdup_or_null(getenv("GIT_CONFIG_SYSTEM"));
- if (system_config)
- return system_config;
- return system_path(ETC_GITCONFIG);
+ if (!system_config)
+ system_config = system_path(ETC_GITCONFIG);
+ normalize_path_copy(system_config, system_config);
+ return system_config;
}
void git_global_config(char **user_out, char **xdg_out)
@@ -2072,7 +2073,7 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
e = xmalloc(sizeof(*e));
hashmap_entry_init(&e->ent, strhash(key));
e->key = xstrdup(key);
- string_list_init(&e->value_list, 1);
+ string_list_init_dup(&e->value_list);
hashmap_add(&cs->config_hash, &e->ent);
}
si = string_list_append_nodup(&e->value_list, xstrdup_or_null(value));
@@ -2837,7 +2838,7 @@ static void maybe_remove_section(struct config_store_data *store,
begin = store->parsed[i].begin;
/*
- * Next, make sure that we are removing he last key(s) in the section,
+ * Next, make sure that we are removing the last key(s) in the section,
* and that there are no comments that are possibly about the current
* section.
*/
@@ -3051,7 +3052,8 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
if (contents == MAP_FAILED) {
if (errno == ENODEV && S_ISDIR(st.st_mode))
errno = EISDIR;
- error_errno(_("unable to mmap '%s'"), config_filename);
+ error_errno(_("unable to mmap '%s'%s"),
+ config_filename, mmap_os_err());
ret = CONFIG_INVALID_FILE;
contents = NULL;
goto out_free;