Skip to content

Commit 04ff2f5

Browse files
committed
Additional error checks for issuing the windows.appendAtomically warning (git-for-windows#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>
2 parents 169aecd + 5e65639 commit 04ff2f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/mingw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ ssize_t mingw_write(int fd, const void *buf, size_t len)
719719
{
720720
ssize_t result = write(fd, buf, len);
721721

722-
if (result < 0 && (errno == EINVAL || errno == ENOSPC) && buf) {
722+
if (result < 0 && (errno == EINVAL || errno == EBADF || errno == ENOSPC) && buf) {
723723
int orig = errno;
724724

725725
/* check if fd is a pipe */
@@ -745,7 +745,7 @@ ssize_t mingw_write(int fd, const void *buf, size_t len)
745745
}
746746

747747
errno = orig;
748-
} else if (orig == EINVAL)
748+
} else if (orig == EINVAL || errno == EBADF)
749749
errno = EPIPE;
750750
else {
751751
DWORD buf_size;

0 commit comments

Comments
 (0)