summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-05 14:01:46 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-05 14:08:12 +0200
commitf30eae7e7a011cb0a17ccbf9d150b155c4d7624c (patch)
tree187da7882437072c60f7b3c49636bfdc826033de /Kernel
parent81d3f823f7cbd1e1c97b0624323c6d376d94b7d8 (diff)
downloadserenity-f30eae7e7a011cb0a17ccbf9d150b155c4d7624c.zip
Kernel: Use TRY() in some Process functions
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.cpp12
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);