mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 00:38:29 +01:00
WIP Fixed issue with modifying dir after append in update
This commit is contained in:
12
lfs.c
12
lfs.c
@@ -846,7 +846,12 @@ static int lfs_dir_update(lfs_t *lfs, lfs_dir_t *dir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove old entry
|
// remove old entry
|
||||||
err = lfs_dir_remove(lfs, dir, &oldentry);
|
err = lfs_dir_fetch(lfs, &olddir, olddir.pair);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = lfs_dir_remove(lfs, &olddir, &oldentry);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -1830,8 +1835,9 @@ lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
|
|||||||
// TODO combine with block allocation?
|
// TODO combine with block allocation?
|
||||||
// TODO need to move out if no longer fits in block also
|
// TODO need to move out if no longer fits in block also
|
||||||
// TODO store INLINE_MAX in superblock?
|
// TODO store INLINE_MAX in superblock?
|
||||||
if ((file->pos + nsize >= LFS_INLINE_MAX) ||
|
if ((file->flags & LFS_F_INLINE) && (
|
||||||
(file->pos + nsize >= lfs->cfg->read_size)) {
|
(file->pos + nsize >= LFS_INLINE_MAX) ||
|
||||||
|
(file->pos + nsize >= lfs->cfg->read_size))) {
|
||||||
int err = lfs_file_relocate(lfs, file);
|
int err = lfs_file_relocate(lfs, file);
|
||||||
if (err) {
|
if (err) {
|
||||||
file->flags |= LFS_F_ERRED;
|
file->flags |= LFS_F_ERRED;
|
||||||
|
|||||||
Reference in New Issue
Block a user