diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-04-19 10:33:08 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-19 11:14:26 +0200 |
commit | 50c139e61c8fa47a22ff042534da4090eb3c5569 (patch) | |
tree | ba13153a7470abe650dd9251c882c20be8c6102f /Libraries/LibCore/DesktopServices.cpp | |
parent | f8b2a7b4a71243fc749d5c466920a1769e5e2982 (diff) | |
download | serenity-50c139e61c8fa47a22ff042534da4090eb3c5569.zip |
LibCore: Check for fork() failure
For those good boy points :^)
Diffstat (limited to 'Libraries/LibCore/DesktopServices.cpp')
-rw-r--r-- | Libraries/LibCore/DesktopServices.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Libraries/LibCore/DesktopServices.cpp b/Libraries/LibCore/DesktopServices.cpp index 393fee2ee2..5fb396593f 100644 --- a/Libraries/LibCore/DesktopServices.cpp +++ b/Libraries/LibCore/DesktopServices.cpp @@ -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; |