Additional error checks for issuing the windows.appendAtomically warning (#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>
This commit is contained in:
Johannes Schindelin 2023-08-07 21:07:40 +02:00
commit 26127c0d42

View File

@ -971,7 +971,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 */
@ -997,7 +997,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;