mirror of
https://github.com/apache/nuttx.git
synced 2026-09-11 13:16:33 +00:00
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 <yinshengkai@xiaomi.com>
This commit is contained in:
parent
70e42f5bfe
commit
006afeb21f
1 changed files with 11 additions and 0 deletions
|
|
@ -559,5 +559,16 @@ FAR const char *inode_nextname(FAR const char *name)
|
|||
name++;
|
||||
}
|
||||
|
||||
/* Skip single '.' path segment, but not '..' */
|
||||
|
||||
if (*name == '.' && *(name + 1) == '/')
|
||||
{
|
||||
/* If there is a '/' after '.',
|
||||
* continue searching from the next character
|
||||
*/
|
||||
|
||||
name = inode_nextname(name);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue