These actually happen for example when the file contains a meta
tag with an empty string value. POSIX says that the read() function
shall return zero and have no other results, so don't return -1 if
the number of bytes read is zero.
Similarly, return zero if the file offset is beyond EOF.
struct aac_afh_context *c = user_data;
uint32_t have, rv;
- if (want == 0 || c->fpos >= c->mapsize) {
- PARA_INFO_LOG("failed attempt to read %u bytes @%zu\n", want,
- c->fpos);
- errno = EAGAIN;
- return -1;
- }
+ if (want == 0 || c->fpos >= c->mapsize)
+ return 0;
have = c->mapsize - c->fpos;
rv = PARA_MIN(have, want);
PARA_DEBUG_LOG("reading %u bytes @%zu\n", rv, c->fpos);