mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-14 11:54:53 +03: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: https://github.com/SerenityOS/serenity/commit/3dab9d0b5c2 Pull-request: https://github.com/SerenityOS/serenity/pull/7788
@ -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…
Reference in New Issue
Block a user