diff --git a/Source/Tests/LinuxSyscalls/Syscalls.cpp b/Source/Tests/LinuxSyscalls/Syscalls.cpp index 59ef057ec..c8bfd1315 100644 --- a/Source/Tests/LinuxSyscalls/Syscalls.cpp +++ b/Source/Tests/LinuxSyscalls/Syscalls.cpp @@ -119,6 +119,17 @@ uint64_t ExecveHandler(const char *pathname, std::vector &argv, std return -ENOENT; } + int pid = getpid(); + + char PidSelfPath[50]; + snprintf(PidSelfPath, 50, "/proc/%i/exe", pid); + + if (strcmp(pathname, "/proc/self/exe") == 0 || strcmp(pathname, PidSelfPath) == 0) { + // If pointing to self then redirect to the application + // JRE and shapez.io does this + Filename = FEX::HLE::_SyscallHandler->Filename(); + } + uint64_t Result{}; if (FEX::HLE::_SyscallHandler->IsInterpreterInstalled()) { // If the FEX interpreter is installed then just execve the thing