fs/procfs: Handle /proc/xxx/group/ correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic9f4c38a3baf199712c5497c094dc7af84deee2c
This commit is contained in:
Xiang Xiao 2020-07-31 02:51:58 +08:00 committed by Abdelatif Guettouche
parent 1bad139f88
commit 0e610caec8
1 changed files with 6 additions and 1 deletions

View File

@ -406,7 +406,12 @@ static FAR const struct proc_node_s *proc_findnode(FAR const char *relpath)
for (i = 0; i < PROC_NNODES; i++)
{
if (strcmp(g_nodeinfo[i]->relpath, relpath) == 0)
size_t len = strlen(g_nodeinfo[i]->relpath);
if (strncmp(g_nodeinfo[i]->relpath, relpath, len) == 0 &&
(relpath[len] == '\0' || (relpath[len] == '/' &&
relpath[len + 1] == '\0' &&
g_nodeinfo[i]->dtype == DTYPE_DIRECTORY)))
{
return g_nodeinfo[i];
}