diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c index 60c591babb..dca3b8b9d5 100644 --- a/fs/smartfs/smartfs_smart.c +++ b/fs/smartfs/smartfs_smart.c @@ -331,10 +331,11 @@ static int smartfs_open(FAR struct file *filep, const char *relpath, /* When using sector buffering, current sector with its header should * always be present in sf->buffer. Otherwise data corruption may arise - * when writing. + * when writing. However, this does not apply when overwriting without + * append mode. */ - if (sf->currsector != SMARTFS_ERASEDSTATE_16BIT) + if ((sf->currsector != SMARTFS_ERASEDSTATE_16BIT) && (oflags & O_APPEND)) { readwrite.logsector = sf->currsector; readwrite.offset = 0;