Thread (1 message) 1 message, 1 author, 2016-06-15

Re: About close() in commit_lock_file()

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:19

Duy Nguyen [off-list ref] writes:
close() is added in commit_lock_file(), before rename(), by 4723ee9
(Close files opened by lock_file() before unlinking. - 2007-11-13),
which is needed by Windows. But doesn't that create a gap between
close() and rename() on other platforms where another process can
replace .lock file with something else before rename() is executed?
Interesting.
Should we enclose close() in #ifdef __MINGW32__ (and maybe
__CYGWIN__)?
Or just have "close and retry" code after seeing rename() fails with
some known errno, without singling out a particular platform?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help