aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/stdio/fflush.c21
-rw-r--r--lib/libc/stdio/fvwrite.c4
-rw-r--r--lib/libc/stdio/wbuf.c2
3 files changed, 10 insertions, 17 deletions
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c
index 7ad6adedf53f..61f23335106f 100644
--- a/lib/libc/stdio/fflush.c
+++ b/lib/libc/stdio/fflush.c
@@ -103,8 +103,8 @@ __weak_reference(__fflush, fflush_unlocked);
int
__sflush(FILE *fp)
{
- unsigned char *p, *old_p;
- int n, f, t, old_w;
+ unsigned char *p;
+ int n, f, t;
f = fp->_flags;
if ((f & __SWR) == 0)
@@ -119,26 +119,19 @@ __sflush(FILE *fp)
* Set these immediately to avoid problems with longjmp and to allow
* exchange buffering (via setvbuf) in user write function.
*/
- old_p = fp->_p;
fp->_p = p;
- old_w = fp->_w;
fp->_w = f & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
for (; n > 0; n -= t, p += t) {
t = _swrite(fp, (char *)p, n);
if (t <= 0) {
- /* Reset _p and _w. */
- if (p > fp->_p) {
+ if (p > fp->_p)
/* Some was written. */
memmove(fp->_p, p, n);
- fp->_p += n;
- if ((fp->_flags & (__SLBF | __SNBF)) == 0)
- fp->_w -= n;
- /* conditional to handle setvbuf */
- } else if (p == fp->_p && errno == EINTR) {
- fp->_p = old_p;
- fp->_w = old_w;
- }
+ /* Reset _p and _w. */
+ fp->_p += n;
+ if ((fp->_flags & __SNBF) == 0)
+ fp->_w -= n;
fp->_flags |= __SERR;
return (EOF);
}
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c
index 81e7ba89a644..26245acca1c9 100644
--- a/lib/libc/stdio/fvwrite.c
+++ b/lib/libc/stdio/fvwrite.c
@@ -139,7 +139,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
fp->_p += w;
old_p = fp->_p;
if (__fflush(fp) == EOF) {
- if (old_p == fp->_p && errno == EINTR)
+ if (old_p == fp->_p)
fp->_p -= w;
goto err;
}
@@ -183,7 +183,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
fp->_p += w;
old_p = fp->_p;
if (__fflush(fp) == EOF) {
- if (old_p == fp->_p && errno == EINTR)
+ if (old_p == fp->_p)
fp->_p -= w;
goto err;
}
diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c
index acbe379ad90e..808cfa588cfb 100644
--- a/lib/libc/stdio/wbuf.c
+++ b/lib/libc/stdio/wbuf.c
@@ -89,7 +89,7 @@ __swbuf(int c, FILE *fp)
old_p = fp->_p;
if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n')) {
if (__fflush(fp) != 0) {
- if (fp->_p == old_p && errno == EINTR) {
+ if (fp->_p == old_p) {
fp->_p--;
fp->_w++;
}