ref: fe91c529db26c3a363c37b6447542dbb4b1f9358
parent: 9c7a7cf4f5fbbc8095cea041f43511c6768ac167
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Nov 13 07:23:51 EST 2021
libc: Fix check in fflush() The check was trying to call _flsbuf() only in output streams, but what it was testing was just the opossite.
--- a/src/libc/stdio/fflush.c
+++ b/src/libc/stdio/fflush.c
@@ -14,7 +14,7 @@
err = 0;
for (fp = __iob; fp < &__iob[FOPEN_MAX]; ++fp) {
- if ((fp->flags & _IOWRITE) == 0 && _flsbuf(fp))
+ if ((fp->flags & _IOWRITE) != 0 && _flsbuf(fp))
err = EOF;
}
return err;