From: Junio C Hamano Date: Mon, 13 Jul 2015 21:00:27 +0000 (-0700) Subject: Merge branch 'kb/config-unmap-before-renaming' X-Git-Tag: v2.5.0-rc2~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/313f52334b2b2b40ab0cedadaf081203de4284d7?ds=inline;hp=-c Merge branch 'kb/config-unmap-before-renaming' "git config" failed to update the configuration file when the underlying filesystem is incapable of renaming a file that is still open. * kb/config-unmap-before-renaming: config.c: fix writing config files on Windows network shares --- 313f52334b2b2b40ab0cedadaf081203de4284d7 diff --combined config.c index 29fa0121d5,69824ebddb..9fd275f2c2 --- a/config.c +++ b/config.c @@@ -50,7 -50,7 +50,7 @@@ static struct config_set the_config_set static int config_file_fgetc(struct config_source *conf) { - return fgetc(conf->u.file); + return getc_unlocked(conf->u.file); } static int config_file_ungetc(int c, struct config_source *conf) @@@ -1088,9 -1088,7 +1088,9 @@@ int git_config_from_file(config_fn_t fn f = fopen(filename, "r"); if (f) { + flockfile(f); ret = do_config_from_file(fn, filename, filename, f, data); + funlockfile(f); fclose(f); } return ret; @@@ -2118,6 -2116,9 +2118,9 @@@ int git_config_set_multivar_in_file(con contents_sz - copy_begin) < contents_sz - copy_begin) goto write_err_out; + + munmap(contents, contents_sz); + contents = NULL; } if (commit_lock_file(lock) < 0) {