summaryrefslogtreecommitdiffstats
path: root/libc/stdio
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2015-02-27 18:22:45 -0800
committerChristopher Ferris <cferris@google.com>2015-02-27 18:22:45 -0800
commitcc9ca1051dbf5bd2af1b801de13d43a399521cf9 (patch)
treef8fd2edf4fd85c87a1b9259c821c4d8f9878b104 /libc/stdio
parente6a33cefe4b3759fb77d9e69356cb50a97ea7e54 (diff)
downloadbionic-cc9ca1051dbf5bd2af1b801de13d43a399521cf9.zip
bionic-cc9ca1051dbf5bd2af1b801de13d43a399521cf9.tar.gz
bionic-cc9ca1051dbf5bd2af1b801de13d43a399521cf9.tar.bz2
Fix fread returning bad data.
Bug: 19172514 Change-Id: I05016577858a02aca7d14e75e6ec28abc925037c
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/fread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index bac8dad..f3f0127 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -102,6 +102,12 @@ fread(void *buf, size_t size, size_t count, FILE *fp)
* avoid copying it through the buffer?
*/
if (total > (size_t) fp->_bf._size) {
+ /*
+ * Make sure that fseek doesn't think it can
+ * reuse the buffer since we are going to read
+ * directly from the file descriptor.
+ */
+ fp->_flags |= __SMOD;
break;
}