mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 07:28:38 +08:00
littlefs: Get and return the current error status before RMDIR execution type
In some cases, deleting a folder will return unexpected results. For example, ENOENT should be returned when deleting a non-existent folder, but the result will return ENOTDIR.
This commit is contained in:
parent
cb0418676f
commit
8b95b7ca5b
1 changed files with 7 additions and 1 deletions
|
@ -1324,8 +1324,14 @@ static int littlefs_mkdir(FAR struct inode *mountpt, FAR const char *relpath,
|
|||
static int littlefs_rmdir(FAR struct inode *mountpt, FAR const char *relpath)
|
||||
{
|
||||
struct stat buf;
|
||||
int ret;
|
||||
|
||||
ret = littlefs_stat(mountpt, relpath, &buf);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
littlefs_stat(mountpt, relpath, &buf);
|
||||
if (S_ISDIR(buf.st_mode))
|
||||
{
|
||||
return littlefs_unlink(mountpt, relpath);
|
||||
|
|
Loading…
Reference in a new issue