summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-11-11 14:40:18 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-11-11 14:40:18 +0000
commit68640edf90c84c3d4494f0852f6236e1929a4603 (patch)
treefe74712bcebdfcc21ef272d83528209ce6e69fbb /firmware/drivers/fat.c
parent228605dc7bfac86604166d5e3bbabb72ae40b78b (diff)
downloadrockbox-68640edf90c84c3d4494f0852f6236e1929a4603.tar.gz
rockbox-68640edf90c84c3d4494f0852f6236e1929a4603.zip
Added ftruncate().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2827 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r--firmware/drivers/fat.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 74bdbd3491..ad1a7a0c82 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1002,12 +1002,15 @@ int fat_truncate(struct fat_file *file)
1002{ 1002{
1003 /* truncate trailing clusters */ 1003 /* truncate trailing clusters */
1004 int next; 1004 int next;
1005 int last = get_next_cluster(file->lastcluster); 1005 int last = file->lastcluster;
1006 while ( last && last != FAT_EOF_MARK ) { 1006
1007 LDEBUGF("fat_truncate(%x, %x)\n", file->firstcluster, last);
1008
1009 for ( last = get_next_cluster(last); last; last = next ) {
1007 next = get_next_cluster(last); 1010 next = get_next_cluster(last);
1008 update_fat_entry(last,0); 1011 update_fat_entry(last,0);
1009 last = next;
1010 } 1012 }
1013 update_fat_entry(file->lastcluster,FAT_EOF_MARK);
1011 1014
1012 return 0; 1015 return 0;
1013} 1016}