summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2003-03-14 15:39:50 +0000
committerHardeep Sidhu <dyp@pobox.com>2003-03-14 15:39:50 +0000
commit67c1a0c63cc1cb0e9f405d6d763b5f642bd998ad (patch)
tree49a0179fa03414ca64108d292c3930b91116444c
parentf2072f03a7083026d985709da342e0b36ee672df (diff)
downloadrockbox-67c1a0c63cc1cb0e9f405d6d763b5f642bd998ad.tar.gz
rockbox-67c1a0c63cc1cb0e9f405d6d763b5f642bd998ad.zip
Make sure we are on correct sector after lseek. This fixes the queue file corruption bug.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3443 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 83c8e045fa..4443b55bca 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -573,6 +573,13 @@ int lseek(int fd, int offset, int whence)
return rc * 10 - 6;
}
file->cacheoffset = sectoroffset;
+
+ /* seek back to current sector */
+ rc = fat_seek(&(file->fatfile), newsector);
+ if ( rc < 0 ) {
+ errno = EIO;
+ return rc * 10 - 7;
+ }
}
else
file->cacheoffset = -1;