This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 9b52e4e littlefs:fix rmdir can remove a file 9b52e4e is described below commit 9b52e4e311f381a08ed99f7b697e71fb6afc0c8f Author: anjiahao <anjia...@xiaomi.com> AuthorDate: Thu Sep 23 14:08:49 2021 +0800 littlefs:fix rmdir can remove a file Signed-off-by: anjiahao <anjia...@xiaomi.com> --- fs/littlefs/lfs_vfs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c index 66b666c..75d3d335 100644 --- a/fs/littlefs/lfs_vfs.c +++ b/fs/littlefs/lfs_vfs.c @@ -1258,7 +1258,17 @@ static int littlefs_mkdir(FAR struct inode *mountpt, FAR const char *relpath, static int littlefs_rmdir(FAR struct inode *mountpt, FAR const char *relpath) { - return littlefs_unlink(mountpt, relpath); + struct stat buf; + + littlefs_stat(mountpt, relpath, &buf); + if (S_ISDIR(buf.st_mode)) + { + return littlefs_unlink(mountpt, relpath); + } + else + { + return -ENOTDIR; + } } /****************************************************************************