Jeff King <peff@xxxxxxxx> writes: > On Wed, Jan 06, 2016 at 02:09:43PM +0100, Johannes Schindelin wrote: > >> It was pointed out by Yaroslav Halchenko that the file containing the >> commit message is writable only by the owner, which means that we have >> to rewrite it from scratch in a shared repository. >> [...] >> diff --git a/wrapper.c b/wrapper.c >> index b43d437..29a45d2 100644 >> --- a/wrapper.c >> +++ b/wrapper.c >> @@ -391,6 +391,19 @@ FILE *xfdopen(int fd, const char *mode) >> return stream; >> } >> >> +FILE *fopen_for_writing(const char *path) >> +{ >> + FILE *ret = fopen(path, "w"); >> + >> + if (!ret && errno == EPERM) { >> + if (!unlink(path)) >> + ret = fopen(path, "w"); >> + else >> + errno = EPERM; >> + } >> + return ret; >> +} > > Thanks, this looks good to me. Having seen the implementation, it really > is just "try harder to fopen()". I guess calling it "fopen_me_harder()" > would be too obscure. :) obscure or you meant some other obsxxxx? fopen_harder() does not sound too bad, but fopen_for_writing() is OK to me. And its use in this patch looks sensible. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html