LibCore: Check for fork() failure

For those good boy points :^)
This commit is contained in:
Sergey Bugaev 2020-04-19 10:33:08 +03:00 committed by Andreas Kling
parent f8b2a7b4a7
commit 50c139e61c
Notes: sideshowbarker 2024-07-19 07:29:01 +09:00

View File

@ -44,7 +44,12 @@ bool DesktopServices::open(const URL& url)
bool spawn(String executable, String argument)
{
if (fork() == 0) {
pid_t child_pid = fork();
if (child_pid < 0) {
perror("fork");
return false;
}
if (child_pid == 0) {
if (execl(executable.characters(), executable.characters(), argument.characters(), nullptr) < 0) {
perror("execl");
return false;