Skip to content

Commit

Permalink
Additional error checks for issuing the windows.appendAtomically warn…
Browse files Browse the repository at this point in the history
…ing (#4528)

Another (hopefully clean) PR for showing the error warning about atomic
append on windows after failure on APFS, which returns EBADF not EINVAL.

Signed-off-by: David Lomas <dl3@pale-eds.co.uk>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Oct 10, 2024
2 parents 80eb6c3 + c0fd681 commit a830d54
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 @@ -721,7 +721,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 @@ -747,7 +747,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 a830d54

Please sign in to comment.