mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
Kernel: Implement offset for lseek
with SEEK_END
This commit is contained in:
parent
f73bb164ad
commit
3dab9d0b5c
Notes:
sideshowbarker
2024-07-18 16:52:18 +09:00
Author: https://github.com/gmta
Commit: 3dab9d0b5c
Pull-request: https://github.com/SerenityOS/serenity/pull/7788
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