Merge branch 'js/fopen-harder'
Some codepaths used fopen(3) when opening a fixed path in $GIT_DIR (e.g. COMMIT_EDITMSG) that is meant to be left after the command is done. This however did not work well if the repository is set to be shared with core.sharedRepository and the umask of the previous user is tighter. They have been made to work better by calling unlink(2) and retrying after fopen(3) fails with EPERM. * js/fopen-harder: Handle more file writes correctly in shared repos commit: allow editing the commit message even in shared repos
This commit is contained in:
@ -761,7 +761,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||
hook_arg2 = "";
|
||||
}
|
||||
|
||||
s->fp = fopen(git_path(commit_editmsg), "w");
|
||||
s->fp = fopen_for_writing(git_path(commit_editmsg));
|
||||
if (s->fp == NULL)
|
||||
die_errno(_("could not open '%s'"), git_path(commit_editmsg));
|
||||
|
||||
|
Reference in New Issue
Block a user