diff options
author | Hardeep Sidhu <dyp@pobox.com> | 2002-12-19 00:51:39 +0000 |
---|---|---|
committer | Hardeep Sidhu <dyp@pobox.com> | 2002-12-19 00:51:39 +0000 |
commit | d2f90c9a74f89c4af0c240d13930990828c833a5 (patch) | |
tree | 959076ec235cd774815abf7710042cc5cb43d467 /firmware | |
parent | 89a180674b90dc8a38c4e9e54accc0ceeb096542 (diff) | |
download | rockbox-d2f90c9a74f89c4af0c240d13930990828c833a5.tar.gz rockbox-d2f90c9a74f89c4af0c240d13930990828c833a5.zip |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/file.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 1d78dcb456..644019effc 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -358,13 +358,11 @@ static int readwrite(int fd, void* buf, int count, bool write) | |||
358 | if (write) { | 358 | if (write) { |
359 | memcpy( file->cache + offs, buf, headbytes ); | 359 | memcpy( file->cache + offs, buf, headbytes ); |
360 | if (offs+headbytes == SECTOR_SIZE) { | 360 | if (offs+headbytes == SECTOR_SIZE) { |
361 | int rc = fat_readwrite(&(file->fatfile), 1, | 361 | int rc = flush_cache(fd); |
362 | file->cache, true ); | ||
363 | if ( rc < 0 ) { | 362 | if ( rc < 0 ) { |
364 | errno = EIO; | 363 | errno = EIO; |
365 | return -2; | 364 | return -2; |
366 | } | 365 | } |
367 | file->dirty = false; | ||
368 | file->cacheoffset = -1; | 366 | file->cacheoffset = -1; |
369 | } | 367 | } |
370 | else | 368 | else |