mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
Kernel+LibC+LibCore: Implement renameat(2)
Now with the ability to specify different bases for the old and new paths.
This commit is contained in:
parent
eb5389e933
commit
d5fbdf1866
Notes:
sideshowbarker
2024-07-17 06:40:21 +09:00
Author: https://github.com/sin-ack
Commit: d5fbdf1866
Pull-request: https://github.com/SerenityOS/serenity/pull/15428
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/BertalanD
Reviewed-by: https://github.com/linusg
Reviewed-by: https://github.com/timschumi
7 changed files with 17 additions and 6 deletions
|
@ -577,14 +577,14 @@ ErrorOr<void> VirtualFileSystem::chmod(Credentials const& credentials, StringVie
|
|||
return chmod(credentials, custody, mode);
|
||||
}
|
||||
|
||||
ErrorOr<void> VirtualFileSystem::rename(Credentials const& credentials, StringView old_path, StringView new_path, Custody& base)
|
||||
ErrorOr<void> VirtualFileSystem::rename(Credentials const& credentials, Custody& old_base, StringView old_path, Custody& new_base, StringView new_path)
|
||||
{
|
||||
RefPtr<Custody> old_parent_custody;
|
||||
auto old_custody = TRY(resolve_path(credentials, old_path, base, &old_parent_custody, O_NOFOLLOW_NOERROR));
|
||||
auto old_custody = TRY(resolve_path(credentials, old_path, old_base, &old_parent_custody, O_NOFOLLOW_NOERROR));
|
||||
auto& old_inode = old_custody->inode();
|
||||
|
||||
RefPtr<Custody> new_parent_custody;
|
||||
auto new_custody_or_error = resolve_path(credentials, new_path, base, &new_parent_custody);
|
||||
auto new_custody_or_error = resolve_path(credentials, new_path, new_base, &new_parent_custody);
|
||||
if (new_custody_or_error.is_error()) {
|
||||
if (new_custody_or_error.error().code() != ENOENT || !new_parent_custody)
|
||||
return new_custody_or_error.release_error();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue