maybe_flush_or_die: move a too-loose Windows specific error
check to compat
Commit b2f5e268
(Windows: Work around an oddity when a pipe with no reader
is written to) introduced a check for EINVAL after fflush() to fight
spurious "Invalid argument" errors on Windows when a pipe was broken. But
this check may hide real errors on systems that do not have the this odd
behavior. Introduce an fflush wrapper in compat/mingw.* so that the treatment
is only applied on Windows.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
bafc478f16
commit
84adb64154
@ -34,12 +34,7 @@ void maybe_flush_or_die(FILE *f, const char *desc)
|
||||
return;
|
||||
}
|
||||
if (fflush(f)) {
|
||||
/*
|
||||
* 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)
|
||||
if (errno == EPIPE)
|
||||
exit(0);
|
||||
die_errno("write failure on '%s'", desc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user