From 4823b2b1c0b40a3b7068a236bbd8cdabb78f4ff1 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Mon, 21 Mar 2011 15:57:07 +0000 Subject: Buffering should truncate if read() returns 0 since it's not a valid return there as there should be data left to read. The loop wouldn't break until there was a message in the queue. I just experienced the case with crosslinked files and read stopped making progress, returning 0 each time it was called. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29626 a1c6a512-1295-4272-9138-f99709370657 --- apps/buffering.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/buffering.c b/apps/buffering.c index f70400a1ee..578f0f261a 100644 --- a/apps/buffering.c +++ b/apps/buffering.c @@ -691,7 +691,7 @@ static bool buffer_handle(int handle_id, size_t to_buffer) /* rc is the actual amount read */ int rc = read(h->fd, &buffer[h->widx], copy_n); - if (rc < 0) { + if (rc <= 0) { /* Some kind of filesystem error, maybe recoverable if not codec */ if (h->type == TYPE_CODEC) { logf("Partial codec"); -- cgit v1.2.3