diff options
author | Elliott Hughes <enh@google.com> | 2015-01-23 17:48:15 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-01-24 12:35:41 -0800 |
commit | e6bb5a27769cc974c4c6c1bfc96dcd07f0c0f5ef (patch) | |
tree | 67156569bf455a9eb3fd18e0151e8e67dfed309c /libc/stdio | |
parent | 31005ca4c8562f3e6dfbed079eeaff8361ff8cdc (diff) | |
download | bionic-e6bb5a27769cc974c4c6c1bfc96dcd07f0c0f5ef.zip bionic-e6bb5a27769cc974c4c6c1bfc96dcd07f0c0f5ef.tar.gz bionic-e6bb5a27769cc974c4c6c1bfc96dcd07f0c0f5ef.tar.bz2 |
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
Diffstat (limited to 'libc/stdio')
-rw-r--r-- | libc/stdio/fread.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 @@ fread(void *buf, size_t size, size_t count, FILE *fp) 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; |