diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-05 14:01:46 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 14:08:12 +0200 |
commit | f30eae7e7a011cb0a17ccbf9d150b155c4d7624c (patch) | |
tree | 187da7882437072c60f7b3c49636bfdc826033de /Kernel | |
parent | 81d3f823f7cbd1e1c97b0624323c6d376d94b7d8 (diff) | |
download | serenity-f30eae7e7a011cb0a17ccbf9d150b155c4d7624c.zip |
Kernel: Use TRY() in some Process functions
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Process.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 87076fef47..c7dc4ad184 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -150,22 +150,14 @@ KResultOr<NonnullRefPtr<Process>> Process::try_create_user_process(RefPtr<Thread arguments.append(parts.last()); } - auto process_or_error = Process::try_create(first_thread, parts.take_last(), uid, gid, ProcessID(0), false, VirtualFileSystem::the().root_custody(), nullptr, tty); - if (process_or_error.is_error()) - return process_or_error.error(); - auto process = process_or_error.release_value(); + auto process = TRY(Process::try_create(first_thread, parts.take_last(), uid, gid, ProcessID(0), false, VirtualFileSystem::the().root_custody(), nullptr, tty)); if (!process->m_fds.try_resize(process->m_fds.max_open())) { first_thread = nullptr; return ENOMEM; } auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : NullDevice::the(); - auto description_or_error = device_to_use_as_tty.open(O_RDWR); - if (description_or_error.is_error()) - return description_or_error.error(); - - auto& description = description_or_error.value(); - + auto description = TRY(device_to_use_as_tty.open(O_RDWR)); auto setup_description = [&process, &description](int fd) { process->m_fds.m_fds_metadatas[fd].allocate(); process->m_fds[fd].set(*description); |