Skip to content

Commit

Permalink
config.c: fix writing config files on Windows network shares
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Karsten Blees authored and Junio C Hamano committed Jun 30, 2015
1 parent 351d06d commit 7a64592
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7a64592

Please sign in to comment.