mirror of
https://github.com/pellepl/spiffs.git
synced 2026-07-28 06:27:47 +00:00
set file offset when seeking over end
The proposed change sets the file offset to the file's end when the file size is smaller than the expected seek index. This allows to use seek to put the file location to a certain position or the end.
This commit is contained in:
@@ -587,6 +587,7 @@ s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) {
|
||||
}
|
||||
|
||||
if ((offs > (s32_t)fd->size) && (SPIFFS_UNDEFINED_LEN != fd->size)) {
|
||||
fd->fdoffset = fd->size;
|
||||
res = SPIFFS_ERR_END_OF_OBJECT;
|
||||
}
|
||||
SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
|
||||
|
||||
Reference in New Issue
Block a user