Skip to content

Commit f70de1c

Browse files
DS-LKGUIDINGLI
authored andcommitted
fs/littlefs: Fix the bug of missing file types
Signed-off-by: zhouliang3 <[email protected]>
1 parent 44992c8 commit f70de1c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/littlefs/lfs_vfs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,7 @@ static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath,
15541554
goto errout;
15551555
}
15561556

1557+
ret = 0;
15571558
memset(&attr, 0, sizeof(attr));
15581559
}
15591560

@@ -1571,6 +1572,15 @@ static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath,
15711572
buf->st_blocks = (buf->st_size + buf->st_blksize - 1) /
15721573
buf->st_blksize;
15731574

1575+
if (info.type == LFS_TYPE_REG)
1576+
{
1577+
buf->st_mode |= S_IFREG;
1578+
}
1579+
else
1580+
{
1581+
buf->st_mode |= S_IFDIR;
1582+
}
1583+
15741584
errout:
15751585
nxmutex_unlock(&fs->lock);
15761586
return ret;
@@ -1605,6 +1615,7 @@ static int littlefs_chstat(FAR struct inode *mountpt,
16051615
goto errout;
16061616
}
16071617

1618+
ret = 0;
16081619
memset(&attr, 0, sizeof(attr));
16091620
}
16101621

0 commit comments

Comments
 (0)