commit fe91c529db26c3a363c37b6447542dbb4b1f9358
parent 9c7a7cf4f5fbbc8095cea041f43511c6768ac167
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;