From: Junio C Hamano Date: Thu, 18 Feb 2016 22:21:37 GMT Subject: Re: [PATCH 09/20] log_ref_setup(): pass the open file descriptor back to the caller Message-ID: In-Reply-To: <10ca076856c8695723f1f5fae1fee2f38fa778fd.1455626201.git.mhagger@alum.mit.edu> Michael Haggerty writes: > 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.