X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/c957a83bde4df2e2d3d1ed0963656856b48ef0a0..224c70764cab4e0e39a26aaf3ad3016552f62f55:/stdio/FreeBSD/fflush.c.patch diff --git a/stdio/FreeBSD/fflush.c.patch b/stdio/FreeBSD/fflush.c.patch new file mode 100644 index 0000000..29fb1fb --- /dev/null +++ b/stdio/FreeBSD/fflush.c.patch @@ -0,0 +1,25 @@ +--- fflush.c.orig 2007-07-20 11:15:28.000000000 -0700 ++++ fflush.c 2007-07-20 15:47:15.000000000 -0700 +@@ -43,6 +43,7 @@ + #include "namespace.h" + #include + #include ++#include + #include "un-namespace.h" + #include "libc_private.h" + #include "local.h" +@@ -126,6 +127,14 @@ + for (; n > 0; n -= t, p += t) { + t = _swrite(fp, (char *)p, n); + if (t <= 0) { ++ /* 5340694: reset _p and _w on EAGAIN */ ++ if (t < 0 && errno == EAGAIN) { ++ if (p > fp->_p) /* some was written */ ++ memmove(fp->_p, p, n); ++ fp->_p += n; ++ if (!(fp->_flags & (__SLBF|__SNBF))) ++ fp->_w -= n; ++ } + fp->_flags |= __SERR; + return (EOF); + }