diff options
Diffstat (limited to 'firmware/common/file.c')
-rw-r--r-- | firmware/common/file.c | 14 |
1 files changed, 8 insertions, 6 deletions
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 ) |