1 --- fflush.c.orig 2007-07-20 11:15:28.000000000 -0700
2 +++ fflush.c 2007-07-20 15:47:15.000000000 -0700
8 #include "un-namespace.h"
9 #include "libc_private.h"
12 for (; n > 0; n -= t, p += t) {
13 t = _swrite(fp, (char *)p, n);
15 + /* 5340694: reset _p and _w on EAGAIN */
16 + if (t < 0 && errno == EAGAIN) {
17 + if (p > fp->_p) /* some was written */
18 + memmove(fp->_p, p, n);
20 + if (!(fp->_flags & (__SLBF|__SNBF)))