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.

This fixes git-for-windows#226.

Signed-off-by: Karsten Blees <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
kblees authored and dscho committed Jul 18, 2015
1 parent 410d6fa commit acee5f8
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 @@ -2135,6 +2135,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 acee5f8

Please sign in to comment.