summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.c
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2007-10-10 23:26:17 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2007-10-10 23:26:17 +0000
commit85058f5d9caa0f9768b155c8963eaed6aa989ed5 (patch)
treeb26d50bf03fce5d8b7cea32a9bcb34d340c60015 /firmware/drivers/fat.c
parentbcdb3217deba791d05ecd46328622831d8ed3b14 (diff)
downloadrockbox-85058f5d9caa0f9768b155c8963eaed6aa989ed5.zip
rockbox-85058f5d9caa0f9768b155c8963eaed6aa989ed5.tar.gz
rockbox-85058f5d9caa0f9768b155c8963eaed6aa989ed5.tar.bz2
rockbox-85058f5d9caa0f9768b155c8963eaed6aa989ed5.tar.xz
Fix FS #5852 by trying to properly close and update the recorded file, and give the FAT the correct file info. Add filehandle checks to some file functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15072 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r--firmware/drivers/fat.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index f117119..a4fa7aa 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -2084,6 +2084,8 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
numsec++;
if ( numsec > (long)fat_bpb->bpb_secperclus || !cluster ) {
long oldcluster = cluster;
+ long oldsector = sector;
+ long oldnumsec = numsec;
if (write)
cluster = next_write_cluster(file, cluster, &sector);
else {
@@ -2099,7 +2101,9 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
if ( write ) {
/* remember last cluster, in case
we want to append to the file */
+ sector = oldsector;
cluster = oldcluster;
+ numsec = oldnumsec;
clusternum--;
i = -1; /* Error code */
break;