From acee5f88ee6f2edee8f4d29337ff8b6d719a45f1 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Tue, 30 Jun 2015 16:34:13 +0200 Subject: [PATCH] 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 Signed-off-by: Johannes Schindelin --- config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.c b/config.c index 098da3066c..7f6e27ac8a 100644 --- a/config.c +++ b/config.c @@ -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) {