mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
Kernel: Implement offset for lseek
with SEEK_END
This commit is contained in:
parent
f73bb164ad
commit
3dab9d0b5c
1 changed files with 3 additions and 1 deletions
|
@ -136,7 +136,9 @@ KResultOr<off_t> FileDescription::seek(off_t offset, int whence)
|
|||
case SEEK_END:
|
||||
if (!metadata().is_valid())
|
||||
return EIO;
|
||||
new_offset = metadata().size;
|
||||
if (Checked<off_t>::addition_would_overflow(metadata().size, offset))
|
||||
return EOVERFLOW;
|
||||
new_offset = metadata().size + offset;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue