From 85058f5d9caa0f9768b155c8963eaed6aa989ed5 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Wed, 10 Oct 2007 23:26:17 +0000 Subject: 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 --- firmware/drivers/fat.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'firmware/drivers') 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, 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, §or); 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; -- cgit v1.2.3