diff options
author | Hardeep Sidhu <dyp@pobox.com> | 2003-03-14 15:39:50 +0000 |
---|---|---|
committer | Hardeep Sidhu <dyp@pobox.com> | 2003-03-14 15:39:50 +0000 |
commit | 67c1a0c63cc1cb0e9f405d6d763b5f642bd998ad (patch) | |
tree | 49a0179fa03414ca64108d292c3930b91116444c | |
parent | f2072f03a7083026d985709da342e0b36ee672df (diff) | |
download | rockbox-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.c | 7 |
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) | |||
573 | return rc * 10 - 6; | 573 | return rc * 10 - 6; |
574 | } | 574 | } |
575 | file->cacheoffset = sectoroffset; | 575 | file->cacheoffset = sectoroffset; |
576 | |||
577 | /* seek back to current sector */ | ||
578 | rc = fat_seek(&(file->fatfile), newsector); | ||
579 | if ( rc < 0 ) { | ||
580 | errno = EIO; | ||
581 | return rc * 10 - 7; | ||
582 | } | ||
576 | } | 583 | } |
577 | else | 584 | else |
578 | file->cacheoffset = -1; | 585 | file->cacheoffset = -1; |