summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKarsten Blees <karsten.blees@gmail.com>2015-06-30 14:34:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-06-30 18:01:59 (GMT)
commit7a64592cf8cc559d6043500b8e77d1fed07c5ec2 (patch)
treedb81b38ed7048d6df69aed9948284e7c86b9f294 /config.c
parent351d06df519ee405a1926e0c6ee34d6a1dba6b46 (diff)
downloadgit-7a64592cf8cc559d6043500b8e77d1fed07c5ec2.zip
git-7a64592cf8cc559d6043500b8e77d1fed07c5ec2.tar.gz
git-7a64592cf8cc559d6043500b8e77d1fed07c5ec2.tar.bz2
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 <blees@dcon.de> Acked-by: Jeff King <peff@peff.net> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/config.c b/config.c
index 27a73c8..69824eb 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) {