1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:27:35 +00:00

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

This commit is contained in:
Andreas Kling 2021-09-05 16:17:24 +02:00
parent f605cd04b6
commit e899ea459c

View file

@ -19,10 +19,8 @@ KResultOr<FlatPtr> Process::sys$lseek(int fd, Userspace<off_t*> userspace_offset
off_t offset;
if (!copy_from_user(&offset, userspace_offset))
return EFAULT;
auto seek_result = description->seek(offset, whence);
if (seek_result.is_error())
return seek_result.error();
if (!copy_to_user(userspace_offset, &seek_result.value()))
auto seek_result = TRY(description->seek(offset, whence));
if (!copy_to_user(userspace_offset, &seek_result))
return EFAULT;
return KSuccess;
}