mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 16:57:35 +00:00
LibCore: Check for fork() failure
For those good boy points :^)
This commit is contained in:
parent
f8b2a7b4a7
commit
50c139e61c
1 changed files with 6 additions and 1 deletions
|
@ -44,7 +44,12 @@ bool DesktopServices::open(const URL& url)
|
||||||
|
|
||||||
bool spawn(String executable, String argument)
|
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) {
|
if (execl(executable.characters(), executable.characters(), argument.characters(), nullptr) < 0) {
|
||||||
perror("execl");
|
perror("execl");
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue