diff options
| author | christos <christos@NetBSD.org> | 2021-07-08 15:44:44 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2021-07-08 15:44:44 +0000 |
| commit | 143d572f8e8ffd2a8dd1a53dbfaf6f098dfcbfa8 (patch) | |
| tree | f9465e7a2e41ee8bf039d2751af14274f52fdedf /lib | |
| parent | 40295dd6a26586569b2224d609a832a967c812a2 (diff) | |
Include the 0 return from write. Although the real write system call does
not return 0, the synthetic writes from funopen/fmemopen could. This avoids
infinite loops in >= test19 in fmemopen, but the tests still fail, perhaps
because they assume the previous behavior, where flush does not adjust the
stdio pointers on error.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/stdio/fflush.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index 0763e2097de..0c8f9c65217 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -1,4 +1,4 @@ -/* $NetBSD: fflush.c,v 1.21 2021/07/08 09:06:51 christos Exp $ */ +/* $NetBSD: fflush.c,v 1.22 2021/07/08 15:44:44 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fflush.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fflush.c,v 1.21 2021/07/08 09:06:51 christos Exp $"); +__RCSID("$NetBSD: fflush.c,v 1.22 2021/07/08 15:44:44 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -107,7 +107,7 @@ __sflush(FILE *fp) for (; n > 0; n -= t, p += t) { t = (*fp->_write)(fp->_cookie, (char *)p, n); - if (t < 0) { + if (t <= 0) { /* Reset _p and _w. */ if (p > fp->_p) { /* Some was written. */ |
