mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-25 19:43:19 -05:00
mingw: suggest windows.appendAtomically in more cases
When running Git for Windows on a remote APFS filesystem, it would appear that the `mingw_open_append()`/`write()` combination would fail almost exactly like on some CIFS-mounted shares as had been reported in https://github.com/git-for-windows/git/issues/2753, albeit with a different `errno` value. Let's handle that `errno` value just the same, by suggesting to set `windows.appendAtomically=false`. Signed-off-by: David Lomas <dl3@pale-eds.co.uk> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
40598f8952
commit
f8c5c67b81
@@ -707,14 +707,14 @@ ssize_t mingw_write(int fd, const void *buf, size_t len)
|
||||
{
|
||||
ssize_t result = write(fd, buf, len);
|
||||
|
||||
if (result < 0 && (errno == EINVAL || errno == ENOSPC) && buf) {
|
||||
if (result < 0 && (errno == EINVAL || errno == EBADF || errno == ENOSPC) && buf) {
|
||||
int orig = errno;
|
||||
|
||||
/* check if fd is a pipe */
|
||||
HANDLE h = (HANDLE) _get_osfhandle(fd);
|
||||
if (GetFileType(h) != FILE_TYPE_PIPE)
|
||||
errno = orig;
|
||||
else if (orig == EINVAL)
|
||||
else if (orig == EINVAL || errno == EBADF)
|
||||
errno = EPIPE;
|
||||
else {
|
||||
DWORD buf_size;
|
||||
|
||||
Reference in New Issue
Block a user