Skip to content

Commit 1ce89e3

Browse files
committed
Added fpurge before seeking file position
1 parent fe8fe18 commit 1ce89e3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: libraries/FS/src/vfs_api.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -429,17 +429,14 @@ bool VFSFileImpl::seek(uint32_t pos, SeekMode mode)
429429
return false;
430430
}
431431

432+
fpurge(_f); //clear the file internal buffer -> no longer valid when changing file position
432433
off_t res = lseek(fileno(_f), pos, mode);
433434
if (res < 0) {
434435
// an error occurred
435436
log_d("FILE SEEK ERROR OCCURED");
436437
return 1; //return error -> for seek its all above 0
437438
}
438-
//return 0; //return success -> for fseek its 0
439-
440-
//Call fseek to adjust pointer in fstruct
441-
auto rc = fseek(_f, pos, mode);
442-
return rc == 0;
439+
return 0; //return success -> for fseek its 0
443440
}
444441

445442
size_t VFSFileImpl::position() const

0 commit comments

Comments
 (0)