Skip to content

Commit 006afeb

Browse files
Gary-Hobsonxiaoxiang781216
authored andcommitted
fs/inode: when searching for nextname skip "/" and "./"
fix the problem that stat fails to use the relative path An error will be reported if used in the following way: stat("//./bin", &st); Signed-off-by: yinshengkai <[email protected]>
1 parent 70e42f5 commit 006afeb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/inode/fs_inodesearch.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,5 +559,16 @@ FAR const char *inode_nextname(FAR const char *name)
559559
name++;
560560
}
561561

562+
/* Skip single '.' path segment, but not '..' */
563+
564+
if (*name == '.' && *(name + 1) == '/')
565+
{
566+
/* If there is a '/' after '.',
567+
* continue searching from the next character
568+
*/
569+
570+
name = inode_nextname(name);
571+
}
572+
562573
return name;
563574
}

0 commit comments

Comments
 (0)