Skip to content

Commit

Permalink
mingw: suggest windows.appendAtomically in more cases
Browse files Browse the repository at this point in the history
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
#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 <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dsl101 authored and Git for Windows Build Agent committed Jan 28, 2025
1 parent a4a8b02 commit 0453ca8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ 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 */
Expand All @@ -813,7 +813,7 @@ ssize_t mingw_write(int fd, const void *buf, size_t len)
}

errno = orig;
} else if (orig == EINVAL)
} else if (orig == EINVAL || errno == EBADF)
errno = EPIPE;
else {
DWORD buf_size;
Expand Down

0 comments on commit 0453ca8

Please sign in to comment.