1
0
Fork 0
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:
Hardeep Sidhu 2002-12-19 00:51:39 +00:00
parent 89a180674b
commit d2f90c9a74

View file

@ -358,13 +358,11 @@ static int readwrite(int fd, void* buf, int count, bool write)
if (write) {
memcpy( file->cache + offs, buf, headbytes );
if (offs+headbytes == SECTOR_SIZE) {
int rc = fat_readwrite(&(file->fatfile), 1,
file->cache, true );
int rc = flush_cache(fd);
if ( rc < 0 ) {
errno = EIO;
return -2;
}
file->dirty = false;
file->cacheoffset = -1;
}
else