mirror of
https://github.com/apache/nuttx.git
synced 2026-05-16 13:56:00 +08:00
littlefs:fix rmdir can remove a file
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
+11
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user