diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c index b0ec7ac2a1..c55b6a7a89 100644 --- a/fs/smartfs/smartfs_smart.c +++ b/fs/smartfs/smartfs_smart.c @@ -1983,10 +1983,22 @@ int smartfs_rename(FAR struct inode *mountpt, FAR const char *oldrelpath, direntry = (FAR struct smartfs_entry_header_s *) &fs->fs_rwbuffer[oldentry.doffset]; #if CONFIG_SMARTFS_ERASEDSTATE == 0xff +#ifdef CONFIG_SMARTFS_ALIGNED_ACCESS + smartfs_wrle16(&direntry->flags, + smartfs_rdle16(&direntry->flags) + & ~SMARTFS_DIRENT_ACTIVE); +#else direntry->flags &= ~SMARTFS_DIRENT_ACTIVE; +#endif +#else /* CONFIG_SMARTFS_ERASEDSTATE == 0xff */ +#ifdef CONFIG_SMARTFS_ALIGNED_ACCESS + smartfs_wrle16(&direntry->flags, + smartfs_rdle16(&direntry->flags) + | SMARTFS_DIRENT_ACTIVE); #else direntry->flags |= SMARTFS_DIRENT_ACTIVE; #endif +#endif /* CONFIG_SMARTFS_ERASEDSTATE == 0xff */ /* Now write the updated flags back to the device */