From 675d258575575afd2439362f44c2a73882a9890e Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 31 Oct 2002 20:41:36 +0000 Subject: Fixed lseek(). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2796 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/file.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'firmware/common/file.c') diff --git a/firmware/common/file.c b/firmware/common/file.c index 3e730c2880..ae5560407b 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c @@ -363,13 +363,15 @@ int lseek(int fd, int offset, int whence) return -4; } } - rc = fat_readwrite(&(openfiles[fd].fatfile), 1, - &(openfiles[fd].cache),false); - if ( rc < 0 ) { - errno = EIO; - return -5; + if ( sectoroffset ) { + rc = fat_readwrite(&(openfiles[fd].fatfile), 1, + &(openfiles[fd].cache),false); + if ( rc < 0 ) { + errno = EIO; + return -5; + } + openfiles[fd].cacheoffset = sectoroffset; } - openfiles[fd].cacheoffset = sectoroffset; } else if ( openfiles[fd].cacheoffset != -1 ) -- cgit v1.2.3