diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c index 5687ab15d7..49bf16cf62 100644 --- a/fs/littlefs/lfs_vfs.c +++ b/fs/littlefs/lfs_vfs.c @@ -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);