Re: [PATCH 09/20] log_ref_setup(): pass the open file descriptor back to the caller
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 18, 2016, 22:21 UTC
- Message-ID
- <xmqqziuxek26.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <10ca076856c8695723f1f5fae1fee2f38fa778fd.1455626201.git.mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 5 quoted lines
> This function will most often be called by log_ref_write_1(), which > wants to append to the reflog file. In that case, it is silly to close > the file only for the caller to reopen it immediately. So, in the case > that the file was opened, pass the open file descriptor back to the > caller.
Makes sense.
> } else {
> adjust_shared_perm(logfile->buf);
> - close(logfd);
> }I briefly wondered if permission twiddling on an open fd may have negative effect on certain platforms, but the original was doing so already (even before step 08/20), so that shouldn't be an issue with this change, either.
Nicely done.