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>
Karsten Blees committed
Jun 30, 2015 at 16:34 UTC
7a64592cf8cc559d6043500b8e77d1fed07c5ec2
1 file changed
+3
config.c
+3
@@ -2116,6 +2116,9 @@ int git_config_set_multivar_in_file(const char *config_filename,
2116
contents_sz - copy_begin) <
2117
contents_sz - copy_begin)
2118
goto write_err_out;
2119
+
2120
+ munmap(contents, contents_sz);
2121
+ contents = NULL;
2122
}
2123
2124
if (commit_lock_file(lock) < 0) {