mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
Kernel: Use KString all the way in sys$execve()
This patch converts all the usage of AK::String around sys$execve() to using KString instead, allowing us to catch and propagate OOM errors. It also required changing the kernel CommandLine helper class to return a vector of KString for the userspace init program arguments.
This commit is contained in:
parent
92363a4ef8
commit
dd82f68326
6 changed files with 48 additions and 41 deletions
|
@ -143,11 +143,13 @@ void Process::register_new(Process& process)
|
|||
});
|
||||
}
|
||||
|
||||
KResultOr<NonnullRefPtr<Process>> Process::try_create_user_process(RefPtr<Thread>& first_thread, StringView path, UserID uid, GroupID gid, Vector<String> arguments, Vector<String> environment, TTY* tty)
|
||||
KResultOr<NonnullRefPtr<Process>> Process::try_create_user_process(RefPtr<Thread>& first_thread, StringView path, UserID uid, GroupID gid, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment, TTY* tty)
|
||||
{
|
||||
auto parts = path.split_view('/');
|
||||
if (arguments.is_empty()) {
|
||||
arguments.append(parts.last());
|
||||
auto last_part = TRY(KString::try_create(parts.last()));
|
||||
if (!arguments.try_append(move(last_part)))
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
auto path_string = TRY(KString::try_create(path));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue