1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

Kernel: Make Process::try_create() propagate errors better

This commit is contained in:
Andreas Kling 2021-09-04 22:41:16 +02:00
parent 3b995c6d01
commit 12f820eb08
3 changed files with 19 additions and 15 deletions

View file

@ -18,9 +18,10 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
REQUIRE_PROMISE(proc);
RefPtr<Thread> child_first_thread;
auto child = Process::try_create(child_first_thread, m_name, uid(), gid(), pid(), m_is_kernel_process, m_cwd, m_executable, m_tty, this);
if (!child || !child_first_thread)
return ENOMEM;
auto child_or_error = Process::try_create(child_first_thread, m_name, uid(), gid(), pid(), m_is_kernel_process, m_cwd, m_executable, m_tty, this);
if (child_or_error.is_error())
return child_or_error.error();
auto child = child_or_error.release_value();
child->m_veil_state = m_veil_state;
child->m_unveiled_paths = m_unveiled_paths.deep_copy();