From 0dab43f171b4b1542991a06fc33d1f7bf9941d25 Mon Sep 17 00:00:00 2001 From: sensslen Date: Wed, 14 Dec 2016 16:44:16 +0100 Subject: [PATCH] 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. --- src/spiffs_hydrogen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spiffs_hydrogen.c b/src/spiffs_hydrogen.c index 1cf64ff..6810823 100644 --- a/src/spiffs_hydrogen.c +++ b/src/spiffs_hydrogen.c @@ -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);