config.c: fix writing config files on Windows network shares

Renaming to an existing file doesn't work on Windows network shares if the
target file is open.

munmap() the old config file before commit_lock_file.

This fixes https://github.com/git-for-windows/git/issues/226.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Karsten Blees
2015-06-30 16:34:13 +02:00
committed by Johannes Schindelin
parent 410d6fad32
commit acee5f88ee

View File

@@ -2135,6 +2135,9 @@ int git_config_set_multivar_in_file(const char *config_filename,
contents_sz - copy_begin) <
contents_sz - copy_begin)
goto write_err_out;
munmap(contents, contents_sz);
contents = NULL;
}
if (commit_lock_file(lock) < 0) {