[+] 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 "RuntimeInternal.hpp"
#include "AuProcAddresses.UNIX.hpp" #include "AuProcAddresses.UNIX.hpp"
#if defined(AURORA_IS_LINUX_DERIVED)
#include "AuProcAddresses.Linux.hpp"
#endif
#include <Source/Debug/ExceptionWatcher.Unix.hpp> #include <Source/Debug/ExceptionWatcher.Unix.hpp>
#include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
namespace Aurora::Process namespace Aurora::Process
@ -42,6 +48,15 @@ namespace Aurora
::close(fd); ::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() void PosixTerminate()
{ {
::killpg(0, SIGKILL); ::killpg(0, SIGKILL);

View File

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

View File

@ -61,8 +61,8 @@ namespace Aurora::Processes
setsid(); setsid();
PosixDoForkHooks(); PosixDoForkHooks();
PosixShutup(); PosixShutup();
PosixFDYeetus();
auto optStringA = AuProcess::EnvironmentGetOne("container"); auto optStringA = AuProcess::EnvironmentGetOne("container");
auto optStringB = AuProcess::EnvironmentGetOne("AURORA_RUNTIME_USE_GDBUS_BIN_TO_PORTAL"); auto optStringB = AuProcess::EnvironmentGetOne("AURORA_RUNTIME_USE_GDBUS_BIN_TO_PORTAL");

View File

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