From 67c1a0c63cc1cb0e9f405d6d763b5f642bd998ad Mon Sep 17 00:00:00 2001 From: Hardeep Sidhu Date: Fri, 14 Mar 2003 15:39:50 +0000 Subject: 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 --- firmware/common/file.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'firmware') 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; -- cgit v1.2.3