Fix optimized fread.
gcov does writes after reads on the same stream, but the bulk read optimization
was clobbering the FILE _flags, causing fwrite to fail.
Bug: 19129055
Change-Id: I9650cb7de4bb173a706b502406266ed0d2b654d7
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index baf62b9..bac8dad 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -120,7 +120,7 @@
while (total > 0) {
ssize_t bytes_read = (*fp->_read)(fp->_cookie, dst, total);
if (bytes_read <= 0) {
- fp->_flags = (fp->_r == 0) ? __SEOF : __SERR;
+ fp->_flags |= (bytes_read == 0) ? __SEOF : __SERR;
break;
}
dst += bytes_read;