From b4ec08738964636795b0da63928752c38232fff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Sat, 6 Jan 2024 13:21:19 -0500 Subject: [PATCH] Fix chdir("/") --- test/libc/calls/getprogramexecutablename_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libc/calls/getprogramexecutablename_test.c b/test/libc/calls/getprogramexecutablename_test.c index 7c94a75c4..77f4b3a61 100644 --- a/test/libc/calls/getprogramexecutablename_test.c +++ b/test/libc/calls/getprogramexecutablename_test.c @@ -38,6 +38,7 @@ static char *self; static bool loaded, skiptests, skiparg0; void SetUpOnce(void) { + self = GetProgramExecutableName(); testlib_enable_tmp_setup_teardown(); if (IsMetal()) { skiptests = true; @@ -70,7 +71,6 @@ void SetUpOnce(void) { __attribute__((__constructor__)) static void Child(int argc, char *argv[]) { loaded = !!__program_executable_name; - self = GetProgramExecutableName(); if (argc >= 2 && !strcmp(argv[1], "Child")) { int rc; if (!IsWindows()) { @@ -81,7 +81,7 @@ __attribute__((__constructor__)) static void Child(int argc, char *argv[]) { if (rc) { exit(122); } - if (strcmp(argv[2], self)) { + if (strcmp(argv[2], GetProgramExecutableName())) { exit(123); } if (argc >= 4) {