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:
zhengyu16 2025-09-24 13:21:09 +08:00 committed by GUIDINGLI
parent e73947e9e7
commit e93046d1b1

View file

@ -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 != '/')