mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
Kernel: Make Process::FileDescriptions::allocate return KResultOr<int>
Modernize more error checking by utilizing KResultOr.
This commit is contained in:
parent
d2cee9cbf6
commit
ba03b6ad02
Notes:
sideshowbarker
2024-07-18 07:59:38 +09:00
Author: https://github.com/bgianfo
Commit: ba03b6ad02
Pull-request: https://github.com/SerenityOS/serenity/pull/9034
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/gunnarbeutner
10 changed files with 48 additions and 37 deletions
|
@ -25,10 +25,10 @@ KResultOr<FlatPtr> Process::sys$anon_create(size_t size, int options)
|
|||
if (size > NumericLimits<ssize_t>::max())
|
||||
return EINVAL;
|
||||
|
||||
int new_fd = m_fds.allocate();
|
||||
if (new_fd < 0)
|
||||
return new_fd;
|
||||
|
||||
auto new_fd_or_error = m_fds.allocate();
|
||||
if (new_fd_or_error.is_error())
|
||||
return new_fd_or_error.error();
|
||||
auto new_fd = new_fd_or_error.value();
|
||||
auto vmobject = AnonymousVMObject::try_create_purgeable_with_size(size, AllocationStrategy::Reserve);
|
||||
if (!vmobject)
|
||||
return ENOMEM;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue