mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Fix not returning errors for the last path item.
Previously the check for an empty part would happen before the check for access and for the parent being a directory, and so an error in those would not be detected.
This commit is contained in:
parent
1a697f70db
commit
27203369b4
Notes:
sideshowbarker
2024-07-19 13:37:36 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/27203369b4e Pull-request: https://github.com/SerenityOS/serenity/pull/227 Reviewed-by: https://github.com/awesomekling
1 changed files with 5 additions and 3 deletions
|
@ -650,9 +650,6 @@ KResultOr<Retained<Custody>> VFS::resolve_path(StringView path, Custody& base, R
|
|||
|
||||
for (int i = 0; i < parts.size(); ++i) {
|
||||
bool inode_was_root_at_head_of_loop = crumb_id.is_root_inode();
|
||||
auto& part = parts[i];
|
||||
if (part.is_empty())
|
||||
break;
|
||||
auto crumb_inode = get_inode(crumb_id);
|
||||
if (!crumb_inode)
|
||||
return KResult(-EIO);
|
||||
|
@ -661,6 +658,11 @@ KResultOr<Retained<Custody>> VFS::resolve_path(StringView path, Custody& base, R
|
|||
return KResult(-ENOTDIR);
|
||||
if (!metadata.may_execute(current->process()))
|
||||
return KResult(-EACCES);
|
||||
|
||||
auto& part = parts[i];
|
||||
if (part.is_empty())
|
||||
break;
|
||||
|
||||
auto current_parent = custody_chain.last();
|
||||
crumb_id = crumb_inode->lookup(part);
|
||||
if (!crumb_id.is_valid())
|
||||
|
|
Loading…
Reference in a new issue