Skip to content

Commit 7a64592

Browse files
kbleesgitster
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. Signed-off-by: Karsten Blees <[email protected]> Acked-by: Jeff King <[email protected]> Acked-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 351d06d commit 7a64592

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
@@ -2116,6 +2116,9 @@ int git_config_set_multivar_in_file(const char *config_filename,
21162116
contents_sz - copy_begin) <
21172117
contents_sz - copy_begin)
21182118
goto write_err_out;
2119+
2120+
munmap(contents, contents_sz);
2121+
contents = NULL;
21192122
}
21202123

21212124
if (commit_lock_file(lock) < 0) {

0 commit comments

Comments
 (0)