mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
littlefs:fix rmdir can remove a file
MIRTOS-889 Signed-off-by: anjiahao <anjiahao@xiaomi.com> Change-Id: I0cf6962f0f5c1fdbe4678918560d45d6c8acc681
This commit is contained in:
+11
-1
@@ -1451,7 +1451,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;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user