Fix fread returning bad data.

Bug: 19172514
Change-Id: I05016577858a02aca7d14e75e6ec28abc925037c
This commit is contained in:
Christopher Ferris
2015-02-27 18:22:45 -08:00
parent e6a33cefe4
commit cc9ca1051d
2 changed files with 44 additions and 0 deletions

View File

@@ -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;
}