mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-29 13:20:49 +00:00
Fix error introduced in last commit: Can't call ferror AFTER closing file
This commit is contained in:
parent
c692ca4238
commit
19bd59a6ca
1 changed files with 4 additions and 2 deletions
|
|
@ -500,6 +500,9 @@ static int nxplayer_enqueuebuffer(FAR struct nxplayer_s *pPlayer,
|
|||
pBuf->nbytes = fread(&pBuf->samp, 1, pBuf->nmaxbytes, pPlayer->fileFd);
|
||||
if (pBuf->nbytes < pBuf->nmaxbytes)
|
||||
{
|
||||
int errcode = errno;
|
||||
int readerror = ferror(pPlayer->fileFd);
|
||||
|
||||
/* End of file or read error.. We are finished with this file in any
|
||||
* event.
|
||||
*/
|
||||
|
|
@ -509,9 +512,8 @@ static int nxplayer_enqueuebuffer(FAR struct nxplayer_s *pPlayer,
|
|||
|
||||
/* Was this a file read error */
|
||||
|
||||
if (ferror(pPlayer->fileFd))
|
||||
if (pBuf->nbytes == 0 && readerror)
|
||||
{
|
||||
int errcode = errno;
|
||||
DEBUGASSERT(errcode > 0);
|
||||
|
||||
auddbg("ERROR: fread failed: %d\n", errcode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue