Browse Source

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>
maint
Karsten Blees 9 years ago committed by Junio C Hamano
parent
commit
7a64592cf8
  1. 3
      config.c

3
config.c

@ -2116,6 +2116,9 @@ int git_config_set_multivar_in_file(const char *config_filename, @@ -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) {

Loading…
Cancel
Save