1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 06:47:34 +00:00

Kernel: Make Process::FileDescriptions::allocate return KResultOr<int>

Modernize more error checking by utilizing KResultOr.
This commit is contained in:
Brian Gianforcaro 2021-07-27 02:12:51 -07:00 committed by Andreas Kling
parent d2cee9cbf6
commit ba03b6ad02
10 changed files with 48 additions and 37 deletions

View file

@ -18,9 +18,10 @@ KResultOr<FlatPtr> Process::sys$create_inode_watcher(u32 flags)
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(rpath);
int fd = m_fds.allocate();
if (fd < 0)
return fd;
auto fd_or_error = m_fds.allocate();
if (fd_or_error.is_error())
return fd_or_error.error();
auto fd = fd_or_error.value();
auto watcher_or_error = InodeWatcher::create();
if (watcher_or_error.is_error())