Skip to content

Commit

Permalink
Fixed seek returns + edited position to use lseek.
Browse files Browse the repository at this point in the history
  • Loading branch information
P-R-O-C-H-Y committed Apr 5, 2022
1 parent 1ce89e3 commit b6b8763
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libraries/FS/src/vfs_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,18 @@ bool VFSFileImpl::seek(uint32_t pos, SeekMode mode)
if (res < 0) {
// an error occurred
log_d("FILE SEEK ERROR OCCURED");
return 1; //return error -> for seek its all above 0
return 0; //return error -> for lseek its all above 0
}
return 0; //return success -> for fseek its 0
return 1; //return success -> for fseek its 0
}

size_t VFSFileImpl::position() const
{
if(_isDirectory || !_f) {
return 0;
}
return ftell(_f);
return lseek(fileno(_f), 0, SEEK_CUR);
//return ftell(_f); // old implementation
}

size_t VFSFileImpl::size() const
Expand Down

0 comments on commit b6b8763

Please sign in to comment.