mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 10:12:07 +00:00
AK: Make Vector::try_* functions return ErrorOr<void>
Instead of signalling allocation failure with a bool return value (false), we now use ErrorOr<void> and return ENOMEM as appropriate. This allows us to use TRY() and MUST() with Vector. :^)
This commit is contained in:
parent
cd49f30bea
commit
88b6428c25
16 changed files with 98 additions and 152 deletions
|
@ -144,18 +144,15 @@ ErrorOr<NonnullRefPtr<Process>> Process::try_create_user_process(RefPtr<Thread>&
|
|||
auto parts = path.split_view('/');
|
||||
if (arguments.is_empty()) {
|
||||
auto last_part = TRY(KString::try_create(parts.last()));
|
||||
if (!arguments.try_append(move(last_part)))
|
||||
return ENOMEM;
|
||||
TRY(arguments.try_append(move(last_part)));
|
||||
}
|
||||
|
||||
auto path_string = TRY(KString::try_create(path));
|
||||
auto name = TRY(KString::try_create(parts.last()));
|
||||
auto process = TRY(Process::try_create(first_thread, move(name), 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;
|
||||
}
|
||||
TRY(process->m_fds.try_resize(process->m_fds.max_open()));
|
||||
|
||||
auto& device_to_use_as_tty = tty ? (CharacterDevice&)*tty : DeviceManagement::the().null_device();
|
||||
auto description = TRY(device_to_use_as_tty.open(O_RDWR));
|
||||
auto setup_description = [&process, &description](int fd) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue