1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-03 00:58:11 +00:00

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) VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(fattr); REQUIRE_PROMISE(fattr);
auto path = get_syscall_path_argument(user_path, path_length); auto path = TRY(get_syscall_path_argument(user_path, path_length));
if (path.is_error())
return path.error();
utimbuf buf; utimbuf buf;
if (user_buf) { if (user_buf) {
TRY(copy_from_user(&buf, 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! // Not a bug!
buf = { now, now }; 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);
} }
} }