mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 16:28:54 +00:00
Kernel: Use find_last_split_view to get the executable name in do_exec
This commit is contained in:
parent
154871834b
commit
ad904cdcab
Notes:
sideshowbarker
2024-07-17 08:54:18 +09:00
Author: https://github.com/Hendiadyoin1
Commit: ad904cdcab
Pull-request: https://github.com/SerenityOS/serenity/pull/14326
Issue: https://github.com/SerenityOS/serenity/issues/14266
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/timschumi ✅
1 changed files with 2 additions and 5 deletions
|
@ -471,12 +471,9 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
|
|||
if (!validate_stack_size(arguments, environment))
|
||||
return E2BIG;
|
||||
|
||||
// FIXME: split_view() currently allocates (Vector) without checking for failure.
|
||||
auto parts = path->view().split_view('/');
|
||||
if (parts.is_empty())
|
||||
return ENOENT;
|
||||
auto last_part = path->view().find_last_split_view('/');
|
||||
|
||||
auto new_process_name = TRY(KString::try_create(parts.last()));
|
||||
auto new_process_name = TRY(KString::try_create(last_part));
|
||||
auto new_main_thread_name = TRY(new_process_name->try_clone());
|
||||
|
||||
auto load_result = TRY(load(main_program_description, interpreter_description, main_program_header));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue