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
This commit is contained in:
Michael Sevakis 2011-03-21 15:57:07 +00:00
parent 82f2bb99ae
commit 4823b2b1c0

View file

@ -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");