forked from len0rd/rockbox
Use flush_cache() when writing headbytes to disk to make sure we are on the correct sector.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3023 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
89a180674b
commit
d2f90c9a74
1 changed files with 1 additions and 3 deletions
|
|
@ -358,13 +358,11 @@ static int readwrite(int fd, void* buf, int count, bool write)
|
||||||
if (write) {
|
if (write) {
|
||||||
memcpy( file->cache + offs, buf, headbytes );
|
memcpy( file->cache + offs, buf, headbytes );
|
||||||
if (offs+headbytes == SECTOR_SIZE) {
|
if (offs+headbytes == SECTOR_SIZE) {
|
||||||
int rc = fat_readwrite(&(file->fatfile), 1,
|
int rc = flush_cache(fd);
|
||||||
file->cache, true );
|
|
||||||
if ( rc < 0 ) {
|
if ( rc < 0 ) {
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
file->dirty = false;
|
|
||||||
file->cacheoffset = -1;
|
file->cacheoffset = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue