diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c index 0dd9d542e8..d810207122 100644 --- a/fs/smartfs/smartfs_smart.c +++ b/fs/smartfs/smartfs_smart.c @@ -1931,7 +1931,12 @@ static void smartfs_stat_common(FAR struct smartfs_mountpt_s *fs, } else { - buf->st_mode = entry->flags & 0xFFF; + /* Mask out the file type */ + + buf->st_mode = entry->flags & ~S_IFMT; + + /* Add the file type based on the SmartFS entry flags */ + if ((entry->flags & SMARTFS_DIRENT_TYPE) == SMARTFS_DIRENT_TYPE_DIR) { buf->st_mode |= S_IFDIR; diff --git a/tools/gencromfs.c b/tools/gencromfs.c index b17063df97..2940991974 100644 --- a/tools/gencromfs.c +++ b/tools/gencromfs.c @@ -100,8 +100,8 @@ #define NUTTX_IRXUSR (NUTTX_IRUSR | NUTTX_IXUSR) -#define NUTTX_IFDIR (2 << 12) -#define NUTTX_IFREG (4 << 12) +#define NUTTX_IFDIR (2 << 11) +#define NUTTX_IFREG (4 << 11) #define NUTTX_IFLNK (1 << 15) /* Bit 15: Symbolic link */