From 50c139e61c8fa47a22ff042534da4090eb3c5569 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Sun, 19 Apr 2020 10:33:08 +0300 Subject: [PATCH] LibCore: Check for fork() failure For those good boy points :^) --- Libraries/LibCore/DesktopServices.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;