Kernel: Use TRY() in sys$utime()

This commit is contained in:
Andreas Kling 2021-09-05 17:53:28 +02:00
parent 789db813d3
commit c5d046c23a

View file

@ -14,9 +14,7 @@ KResultOr<FlatPtr> Process::sys$utime(Userspace<const char*> user_path, size_t p
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(fattr);
auto path = get_syscall_path_argument(user_path, path_length);
if (path.is_error())
return path.error();
auto path = TRY(get_syscall_path_argument(user_path, path_length));
utimbuf buf;
if (user_buf) {
TRY(copy_from_user(&buf, user_buf));
@ -25,7 +23,7 @@ KResultOr<FlatPtr> Process::sys$utime(Userspace<const char*> user_path, size_t p
// Not a bug!
buf = { now, now };
}
return VirtualFileSystem::the().utime(path.value()->view(), current_directory(), buf.actime, buf.modtime);
return VirtualFileSystem::the().utime(path->view(), current_directory(), buf.actime, buf.modtime);
}
}