mirror of
https://github.com/apache/nuttx.git
synced 2026-08-28 21:00:44 +00:00
fs/inode: return ENOENT if pathname is empty in inode_search
An empty pathname does not name any inode. Return -ENOENT early in inode_search() when the path is an empty string, instead of continuing into the search logic with a zero-length path. Signed-off-by: zhengyu16 <zhengyu16@xiaomi.com>
This commit is contained in:
parent
e73947e9e7
commit
e93046d1b1
1 changed files with 5 additions and 0 deletions
|
|
@ -477,6 +477,11 @@ int inode_search(FAR struct inode_search_s *desc)
|
|||
|
||||
DEBUGASSERT(desc != NULL && desc->path != NULL);
|
||||
|
||||
if (*desc->path == '\0')
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* Convert the relative path to the absolute path */
|
||||
|
||||
if (*desc->path != '/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue