From 7a64592cf8cc559d6043500b8e77d1fed07c5ec2 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. Signed-off-by: Karsten Blees Acked-by: Jeff King Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.c b/config.c index 27a73c8500..69824ebddb 100644 --- a/config.c +++ b/config.c @@ -2116,6 +2116,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) {