mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-16 14:32:18 +00:00
Kernel: Make utimensat ignore the dirfd when given an absolute path
This commit is contained in:
parent
bda914868b
commit
05cf1327ed
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/implicitfield
Commit: 05cf1327ed
Pull-request: https://github.com/SerenityOS/serenity/pull/23099
Reviewed-by: https://github.com/timschumi ✅
1 changed files with 8 additions and 1 deletions
|
@ -69,8 +69,15 @@ ErrorOr<FlatPtr> Process::sys$utimensat(Userspace<Syscall::SC_utimensat_params c
|
|||
times[1] = now;
|
||||
}
|
||||
|
||||
auto resolve_base = [&](StringView path) -> ErrorOr<NonnullRefPtr<Custody>> {
|
||||
if (!path.is_empty() && path[0] == '/')
|
||||
return VirtualFileSystem::the().root_custody();
|
||||
else
|
||||
return custody_for_dirfd(params.dirfd);
|
||||
};
|
||||
|
||||
auto path = TRY(get_syscall_path_argument(params.path));
|
||||
auto base = TRY(custody_for_dirfd(params.dirfd));
|
||||
auto base = TRY(resolve_base(path->view()));
|
||||
auto& atime = times[0];
|
||||
auto& mtime = times[1];
|
||||
TRY(VirtualFileSystem::the().utimensat(credentials(), path->view(), *base, atime, mtime, follow_symlink));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue