mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
fs_procfs:Fix closedir should handle the release dir handle on a case-by-case basis
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
+17
-2
@@ -787,9 +787,24 @@ static int procfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
|
|||||||
static int procfs_closedir(FAR struct inode *mountpt,
|
static int procfs_closedir(FAR struct inode *mountpt,
|
||||||
FAR struct fs_dirent_s *dir)
|
FAR struct fs_dirent_s *dir)
|
||||||
{
|
{
|
||||||
|
FAR struct procfs_dir_priv_s *dirpriv;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
DEBUGASSERT(mountpt && dir);
|
DEBUGASSERT(mountpt && dir);
|
||||||
fs_heap_free(dir);
|
|
||||||
return OK;
|
dirpriv = (FAR struct procfs_dir_priv_s *)dir;
|
||||||
|
|
||||||
|
if (dirpriv->procfsentry != NULL &&
|
||||||
|
dirpriv->procfsentry->ops->closedir != NULL)
|
||||||
|
{
|
||||||
|
ret = dirpriv->procfsentry->ops->closedir(dir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fs_heap_free(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user