mirror of
https://github.com/git/git.git
synced 2026-02-07 08:15:23 +00:00
squash! mingw: emulate write(2) that fails with a SIGPIPE
We fail with EPIPE, not SIGPIPE... Also, replace paragraph about EINVAL on Windows by: According to the documentation, there are two cases in which write() triggers EINVAL: the buffer is NULL, or the length is odd but the mode is 16-bit Unicode (the broken pipe is not mentioned as possible cause). Git never sets the file mode to anything but binary, therefore we know that errno should actually be EPIPE if it is EINVAL and the buffer is not NULL. And append: This works around t5571.11 failing with v2.6.4.
This commit is contained in:
@@ -229,7 +229,7 @@ static inline ssize_t mingw_write(int fd, const void *buf, size_t len)
|
||||
{
|
||||
ssize_t result = write(fd, buf, len);
|
||||
|
||||
if (result < 0 && errno == EINVAL) {
|
||||
if (result < 0 && errno == EINVAL && buf) {
|
||||
/* check if fd is a pipe */
|
||||
HANDLE h = (HANDLE) _get_osfhandle(fd);
|
||||
if (GetFileType(h) == FILE_TYPE_PIPE)
|
||||
|
||||
Reference in New Issue
Block a user