mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
fs/littlefs: Fix the bug of missing file types
N/A Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com> Change-Id: If6eee288558d5325c1ee15d63f6ad35bcdb5ffa7
This commit is contained in:
@@ -1448,6 +1448,7 @@ static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath,
|
||||
goto errout;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
}
|
||||
|
||||
@@ -1465,6 +1466,15 @@ static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath,
|
||||
buf->st_blocks = (buf->st_size + buf->st_blksize - 1) /
|
||||
buf->st_blksize;
|
||||
|
||||
if (info.type == LFS_TYPE_REG)
|
||||
{
|
||||
buf->st_mode |= S_IFREG;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->st_mode |= S_IFDIR;
|
||||
}
|
||||
|
||||
errout:
|
||||
littlefs_semgive(fs);
|
||||
return ret;
|
||||
@@ -1498,6 +1508,7 @@ static int littlefs_chstat(FAR struct inode *mountpt,
|
||||
goto errout;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user