fs/littlefs: Fix the bug of missing file types
Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
This commit is contained in:
parent
44992c8821
commit
f70de1c65f
|
@ -1554,6 +1554,7 @@ static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath,
|
|||
goto errout;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
}
|
||||
|
||||
|
@ -1571,6 +1572,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:
|
||||
nxmutex_unlock(&fs->lock);
|
||||
return ret;
|
||||
|
@ -1605,6 +1615,7 @@ static int littlefs_chstat(FAR struct inode *mountpt,
|
|||
goto errout;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue