Skip to content

Commit 36d5d2e

Browse files
kbleesdscho
authored andcommitted
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. This fixes #226. Signed-off-by: Karsten Blees <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 4428d26 commit 36d5d2e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,9 @@ int git_config_set_multivar_in_file(const char *config_filename,
21532153
contents_sz - copy_begin) <
21542154
contents_sz - copy_begin)
21552155
goto write_err_out;
2156+
2157+
munmap(contents, contents_sz);
2158+
contents = NULL;
21562159
}
21572160

21582161
if (commit_lock_file(lock) < 0) {

0 commit comments

Comments
 (0)