Another fix for file system issues when encountering disk full (like when recording)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15920 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2007-12-13 23:36:22 +00:00
parent 10d0344e29
commit eb947cdde1
4 changed files with 35 additions and 3 deletions

View file

@ -2329,6 +2329,9 @@ static bool on_start_file(struct enc_file_event_data *data)
static bool on_end_file(struct enc_file_event_data *data)
{
if (data->rec_file < 0)
return false; /* file already closed, nothing more we can do */
/* always _try_ to write the file header, even on error */
if (ci->close(data->rec_file) != 0)
return false;

View file

@ -144,10 +144,12 @@ static bool on_end_file(struct enc_file_event_data *data)
struct riff_header hdr;
uint32_t data_size;
/* always _try_ to write the file header, even on error */
if (data->rec_file < 0)
return false; /* file already closed, nothing more we can do */
if (ci->lseek(data->rec_file, 0, SEEK_SET) != 0 ||
ci->read(data->rec_file, &hdr, sizeof (hdr)) != sizeof (hdr))
/* always _try_ to write the file header, even on error */
if ((ci->lseek(data->rec_file, 0, SEEK_SET)) ||
(ci->read(data->rec_file, &hdr, sizeof (hdr)) != sizeof (hdr)))
{
return false;
}

View file

@ -257,6 +257,9 @@ static bool on_end_file(struct enc_file_event_data *data)
uint32_t data_size;
if (data->rec_file < 0)
return false; /* file already closed, nothing more we can do */
/* always _try_ to write the file header, even on error */
/* read template headers at start */