Closed alonbl closed 10 months ago
I wonder why I wrote if (m == O_APPEND)
instead of if (m & O_APPEND)
. Investigating to see if there was a reason.
You are right, the two lines are suspicious:
if (m == O_APPEND) {ESP_LOGV(ESP_LITTLEFS_TAG, "O_APPEND"); lfs_flags |= LFS_O_APPEND;}
if (m == O_RDONLY) {ESP_LOGV(ESP_LITTLEFS_TAG, "O_RDONLY"); lfs_flags |= LFS_O_RDONLY;}
The naive solution is just to replace those two ==
with &
, just trying to make sure that
so the naive solution doesn't work, looking at other filesystem implementations, they do explicit checking as well. Diving a little deeper.
oh derp, O_RDONLY
is 0
, so that makes sense why we're explicitly checking that.
Fixed by #156 and in release v1.10.2. Thanks for opening the issue!
Thank you!
Hi,
I am unsure where the exact issue is, I believe this is in the littlefs.
Provided the following code in a modified example of
esp-idf
:The output is:
As you can see the
O_APPEND
flag was provided and have no affect, content was overridden.The expected output (tested on Linux):
The O_APPEND should cause seek to the end of file before each write.
Looking at the littlefs code the only reference of append is the following:
No use of
LFS_O_APPEND
anywhere.Workaround (as long as we do not support concurrent access:
Thanks,