diff --git a/Kernel/Syscalls/utimensat.cpp b/Kernel/Syscalls/utimensat.cpp index 0855b5ee380..6128be1277f 100644 --- a/Kernel/Syscalls/utimensat.cpp +++ b/Kernel/Syscalls/utimensat.cpp @@ -69,8 +69,15 @@ ErrorOr Process::sys$utimensat(Userspace ErrorOr> { + 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));