mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Fix a panic in VFS::rename()
If we get an -ENOENT when resolving the target because of some part, that is not the very last part, missing, we should just return the error instead of panicking later :^) To test: $ mkdir /tmp/foo/ $ mv /tmp/foo/ /tmp/bar/ Related to https://github.com/SerenityOS/serenity/issues/1253
This commit is contained in:
parent
3439498744
commit
1d2986ea15
Notes:
sideshowbarker
2024-07-19 09:11:29 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/1d2986ea15e Pull-request: https://github.com/SerenityOS/serenity/pull/1256
1 changed files with 1 additions and 1 deletions
|
@ -433,7 +433,7 @@ KResult VFS::rename(StringView old_path, StringView new_path, Custody& base)
|
|||
RefPtr<Custody> new_parent_custody;
|
||||
auto new_custody_or_error = resolve_path(new_path, base, &new_parent_custody);
|
||||
if (new_custody_or_error.is_error()) {
|
||||
if (new_custody_or_error.error() != -ENOENT)
|
||||
if (new_custody_or_error.error() != -ENOENT || !new_parent_custody)
|
||||
return new_custody_or_error.error();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue