From d3fabf21d6cfe293749ba2badb4f58ef534b73d8 Mon Sep 17 00:00:00 2001 From: SirLynix Date: Fri, 26 Jan 2024 10:07:26 +0100 Subject: [PATCH] Core/Posix: Use _exit instead of exit for intermediary process --- src/Nazara/Core/Posix/ProcessImpl.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Nazara/Core/Posix/ProcessImpl.cpp b/src/Nazara/Core/Posix/ProcessImpl.cpp index bc82fbfe9..7c7707d25 100644 --- a/src/Nazara/Core/Posix/ProcessImpl.cpp +++ b/src/Nazara/Core/Posix/ProcessImpl.cpp @@ -49,7 +49,6 @@ namespace Nz::PlatformImpl // Double fork (see https://0xjet.github.io/3OHA/2022/04/11/post.html) // We will create a child and a grand-child process, using a pipe to retrieve the grand-child pid - // TODO: Use posix_spawn if possible instead pid_t childPid = ::fork(); if (childPid == -1) return Err("failed to create child: " + Error::GetLastSystemError()); @@ -70,7 +69,7 @@ namespace Nz::PlatformImpl pipe.Write(&err, sizeof(err)); // Early exit - std::exit(1); + _exit(EXIT_FAILURE); } } @@ -94,7 +93,7 @@ namespace Nz::PlatformImpl pipe.Write(&pid, sizeof(pid)); // Exits the child process, at this point the grand-child should have started - std::exit(0); + _exit(EXIT_SUCCESS); } else { @@ -104,7 +103,7 @@ namespace Nz::PlatformImpl pipe.Write(&err, sizeof(err)); - std::exit(1); + _exit(EXIT_FAILURE); } NAZARA_UNREACHABLE();