summaryrefslogtreecommitdiff
path: root/src/stdio/ext2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/ext2.c')
-rw-r--r--src/stdio/ext2.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/stdio/ext2.c b/src/stdio/ext2.c
index afd8b34e..34162780 100644
--- a/src/stdio/ext2.c
+++ b/src/stdio/ext2.c
@@ -3,14 +3,13 @@
size_t __freadahead(FILE *f)
{
- return f->rend - f->rpos;
+ return f->rend ? f->rend - f->rpos : 0;
}
const char *__freadptr(FILE *f, size_t *sizep)
{
- size_t size = f->rend - f->rpos;
- if (!size) return 0;
- *sizep = size;
+ if (f->rpos == f->rend) return 0;
+ *sizep = f->rend - f->rpos;
return (const char *)f->rpos;
}