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.tar.gz
rockbox-85058f5d9caa0f9768b155c8963eaed6aa989ed5.zip
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 f117119258..a4fa7aa933 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -2084,6 +2084,8 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
2084 numsec++; 2084 numsec++;
2085 if ( numsec > (long)fat_bpb->bpb_secperclus || !cluster ) { 2085 if ( numsec > (long)fat_bpb->bpb_secperclus || !cluster ) {
2086 long oldcluster = cluster; 2086 long oldcluster = cluster;
2087 long oldsector = sector;
2088 long oldnumsec = numsec;
2087 if (write) 2089 if (write)
2088 cluster = next_write_cluster(file, cluster, &sector); 2090 cluster = next_write_cluster(file, cluster, &sector);
2089 else { 2091 else {
@@ -2099,7 +2101,9 @@ long fat_readwrite( struct fat_file *file, long sectorcount,
2099 if ( write ) { 2101 if ( write ) {
2100 /* remember last cluster, in case 2102 /* remember last cluster, in case
2101 we want to append to the file */ 2103 we want to append to the file */
2104 sector = oldsector;
2102 cluster = oldcluster; 2105 cluster = oldcluster;
2106 numsec = oldnumsec;
2103 clusternum--; 2107 clusternum--;
2104 i = -1; /* Error code */ 2108 i = -1; /* Error code */
2105 break; 2109 break;