diff options
author | Johannes Sixt <j6t@kdbg.org> | 2018-08-13 21:02:50 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-13 15:22:19 -0700 |
commit | d641097589160eb795127d8dbcb14c877c217b60 (patch) | |
tree | accb48f745a2dbb95d8c6cb79fb2856c6b624bc7 /diff.c | |
parent | Git 2.18 (diff) | |
download | tgif-d641097589160eb795127d8dbcb14c877c217b60.tar.xz |
mingw: enable atomic O_APPEND
The Windows CRT implements O_APPEND "manually": on write() calls, the
file pointer is set to EOF before the data is written. Clearly, this is
not atomic. And in fact, this is the root cause of failures observed in
t5552-skipping-fetch-negotiator.sh and t5503-tagfollow.sh, where
different processes write to the same trace file simultanously; it also
occurred in t5400-send-pack.sh, but there it was worked around in
71406ed4d6 ("t5400: avoid concurrent writes into a trace file",
2017-05-18).
Fortunately, Windows does support atomic O_APPEND semantics using the
file access mode FILE_APPEND_DATA. Provide an implementation that does.
This implementation is minimal in such a way that it only implements
the open modes that are actually used in the Git code base. Emulation
for other modes can be added as necessary later. To become aware of
the necessity early, the unusal error ENOSYS is reported if an
unsupported mode is encountered.
Diagnosed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Helped-by: Jeff Hostetler <git@jeffhostetler.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions