Added ftruncate().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2827 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-11-11 14:40:18 +00:00
parent 228605dc7b
commit 68640edf90
3 changed files with 33 additions and 4 deletions

View file

@ -1002,12 +1002,15 @@ int fat_truncate(struct fat_file *file)
{
/* truncate trailing clusters */
int next;
int last = get_next_cluster(file->lastcluster);
while ( last && last != FAT_EOF_MARK ) {
int last = file->lastcluster;
LDEBUGF("fat_truncate(%x, %x)\n", file->firstcluster, last);
for ( last = get_next_cluster(last); last; last = next ) {
next = get_next_cluster(last);
update_fat_entry(last,0);
last = next;
}
update_fat_entry(file->lastcluster,FAT_EOF_MARK);
return 0;
}