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:
sensslen
2016-12-14 16:44:16 +01:00
committed by GitHub
parent 21fe570974
commit 0dab43f171
+1
View File
@@ -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);