commit 7500b7ca1f7302698e2e75c0a98c004ebb3f3289
parent cc7f54a16640c2fbcf06a7c310fc02f22d6e984c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 13 Nov 2021 12:23:51 +0100
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libc/stdio/fflush.c b/src/libc/stdio/fflush.c
@@ -14,7 +14,7 @@ fflush(FILE *fp)
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;