Core/Posix: Use _exit instead of exit for intermediary process
This commit is contained in:
parent
625b4f2d9f
commit
d3fabf21d6
|
|
@ -49,7 +49,6 @@ namespace Nz::PlatformImpl
|
||||||
|
|
||||||
// Double fork (see https://0xjet.github.io/3OHA/2022/04/11/post.html)
|
// 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
|
// 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();
|
pid_t childPid = ::fork();
|
||||||
if (childPid == -1)
|
if (childPid == -1)
|
||||||
return Err("failed to create child: " + Error::GetLastSystemError());
|
return Err("failed to create child: " + Error::GetLastSystemError());
|
||||||
|
|
@ -70,7 +69,7 @@ namespace Nz::PlatformImpl
|
||||||
pipe.Write(&err, sizeof(err));
|
pipe.Write(&err, sizeof(err));
|
||||||
|
|
||||||
// Early exit
|
// Early exit
|
||||||
std::exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +93,7 @@ namespace Nz::PlatformImpl
|
||||||
pipe.Write(&pid, sizeof(pid));
|
pipe.Write(&pid, sizeof(pid));
|
||||||
|
|
||||||
// Exits the child process, at this point the grand-child should have started
|
// Exits the child process, at this point the grand-child should have started
|
||||||
std::exit(0);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -104,7 +103,7 @@ namespace Nz::PlatformImpl
|
||||||
|
|
||||||
pipe.Write(&err, sizeof(err));
|
pipe.Write(&err, sizeof(err));
|
||||||
|
|
||||||
std::exit(1);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NAZARA_UNREACHABLE();
|
NAZARA_UNREACHABLE();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue