[+] PosixFDYeetus()

This commit is contained in:
Reece Wilson 2024-04-14 19:48:40 +01:00
parent 0164919cd9
commit 971b007ab9
4 changed files with 19 additions and 7 deletions

View File

@ -7,7 +7,13 @@
***/
#include "RuntimeInternal.hpp"
#include "AuProcAddresses.UNIX.hpp"
#if defined(AURORA_IS_LINUX_DERIVED)
#include "AuProcAddresses.Linux.hpp"
#endif
#include <Source/Debug/ExceptionWatcher.Unix.hpp>
#include <unistd.h>
#include <sys/mman.h>
namespace Aurora::Process
@ -42,6 +48,15 @@ namespace Aurora
::close(fd);
}
void PosixFDYeetus()
{
#if defined(AURORA_IS_BSD_DERIVED)
closefrom(STDERR_FILENO + 1);
#elif defined(AURORA_IS_LINUX_DERIVED)
close_range(STDERR_FILENO + 1, UINT_MAX, 0);
#endif
}
void PosixTerminate()
{
::killpg(0, SIGKILL);

View File

@ -15,6 +15,7 @@ namespace Aurora
void PosixDoForkHooks();
void PosixShutup();
void PosixTerminate();
void PosixFDYeetus();
int PosixOpen(const char *pathname, int flags, mode_t mode = 0);

View File

@ -61,9 +61,9 @@ namespace Aurora::Processes
setsid();
PosixDoForkHooks();
PosixShutup();
PosixFDYeetus();
auto optStringA = AuProcess::EnvironmentGetOne("container");
auto optStringB = AuProcess::EnvironmentGetOne("AURORA_RUNTIME_USE_GDBUS_BIN_TO_PORTAL");
bool bIsFireJail = optStringA && optStringA.Value() == "firejail";

View File

@ -607,11 +607,7 @@ namespace Aurora::Processes
}
}
#if defined(AURORA_IS_BSD_DERIVED)
closefrom(STDERR_FILENO + 1);
#elif defined(AURORA_IS_LINUX_DERIVED)
close_range(STDERR_FILENO + 1, UINT_MAX, 0);
#endif
PosixFDYeetus();
if (this->startup_.environmentVariables.size())
{