mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Work around a Windows oddity when a pipe with no reader is written to.
The first WriteFile() returns ERROR_BROKEN_PIPE, subsequent WriteFile()s return ERROR_NO_DATA, which is not translated to EPIPE, but EINVAL. Hmpf!
This commit is contained in:
committed by
Johannes Schindelin
parent
93f2b75370
commit
73b51e93d2
@@ -34,7 +34,16 @@ void maybe_flush_or_die(FILE *f, const char *desc)
|
||||
return;
|
||||
}
|
||||
if (fflush(f)) {
|
||||
#ifndef __MINGW32__
|
||||
if (errno == EPIPE)
|
||||
#else
|
||||
/*
|
||||
* On Windows, EPIPE is returned only by the first write()
|
||||
* after the reading end has closed its handle; subsequent
|
||||
* write()s return EINVAL.
|
||||
*/
|
||||
if (errno == EPIPE || errno == EINVAL)
|
||||
#endif
|
||||
exit(0);
|
||||
die("write failure on %s: %s", desc, strerror(errno));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user