Fix chdir("/")

This commit is contained in:
Jōshin 2024-01-06 13:21:19 -05:00
parent 9157711b6e
commit b4ec087389
No known key found for this signature in database

View file

@ -38,6 +38,7 @@ static char *self;
static bool loaded, skiptests, skiparg0; static bool loaded, skiptests, skiparg0;
void SetUpOnce(void) { void SetUpOnce(void) {
self = GetProgramExecutableName();
testlib_enable_tmp_setup_teardown(); testlib_enable_tmp_setup_teardown();
if (IsMetal()) { if (IsMetal()) {
skiptests = true; skiptests = true;
@ -70,7 +71,6 @@ void SetUpOnce(void) {
__attribute__((__constructor__)) static void Child(int argc, char *argv[]) { __attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
loaded = !!__program_executable_name; loaded = !!__program_executable_name;
self = GetProgramExecutableName();
if (argc >= 2 && !strcmp(argv[1], "Child")) { if (argc >= 2 && !strcmp(argv[1], "Child")) {
int rc; int rc;
if (!IsWindows()) { if (!IsWindows()) {
@ -81,7 +81,7 @@ __attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
if (rc) { if (rc) {
exit(122); exit(122);
} }
if (strcmp(argv[2], self)) { if (strcmp(argv[2], GetProgramExecutableName())) {
exit(123); exit(123);
} }
if (argc >= 4) { if (argc >= 4) {