mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
Kernel: Use TRY() in sys$lseek()
This commit is contained in:
parent
f605cd04b6
commit
e899ea459c
1 changed files with 2 additions and 4 deletions
|
@ -19,10 +19,8 @@ KResultOr<FlatPtr> Process::sys$lseek(int fd, Userspace<off_t*> userspace_offset
|
||||||
off_t offset;
|
off_t offset;
|
||||||
if (!copy_from_user(&offset, userspace_offset))
|
if (!copy_from_user(&offset, userspace_offset))
|
||||||
return EFAULT;
|
return EFAULT;
|
||||||
auto seek_result = description->seek(offset, whence);
|
auto seek_result = TRY(description->seek(offset, whence));
|
||||||
if (seek_result.is_error())
|
if (!copy_to_user(userspace_offset, &seek_result))
|
||||||
return seek_result.error();
|
|
||||||
if (!copy_to_user(userspace_offset, &seek_result.value()))
|
|
||||||
return EFAULT;
|
return EFAULT;
|
||||||
return KSuccess;
|
return KSuccess;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue