summaryrefslogtreecommitdiff
path: root/apps/buffering.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/buffering.c')
-rw-r--r--apps/buffering.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index e55e81da45..0a26673696 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -984,8 +984,11 @@ static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
size_t avail = RINGBUF_SUB(h->widx, h->ridx);
if (avail == 0 && h->filerem == 0)
+ {
/* File is finished reading */
- return 0;
+ *size = 0;
+ return h;
+ }
if (*size == 0 || *size > avail + h->filerem)
*size = avail + h->filerem;