mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 17:00:19 +02:00
Merge pull request #1021 from Sonicadvance1/fix_thread_self
Support redirecting thread-self exe softlink
This commit is contained in:
commit
bee73199e1
2 files changed
+9
-3
No files matched your search
@@ -161,7 +161,9 @@ std::optional<std::string> FileManager::GetSelf(const char *Pathname) {
|
||||
char PidSelfPath[50];
|
||||
snprintf(PidSelfPath, 50, "/proc/%i/exe", pid);
|
||||
|
||||
if (strcmp(Pathname, "/proc/self/exe") == 0 || strcmp(Pathname, PidSelfPath) == 0) {
|
||||
if (strcmp(Pathname, "/proc/self/exe") == 0 ||
|
||||
strcmp(Pathname, "/proc/thread-self/exe") == 0 ||
|
||||
strcmp(Pathname, PidSelfPath) == 0) {
|
||||
return Filename();
|
||||
}
|
||||
|
||||
@@ -262,7 +264,9 @@ uint64_t FileManager::Readlink(const char *pathname, char *buf, size_t bufsiz) {
|
||||
char PidSelfPath[50];
|
||||
snprintf(PidSelfPath, 50, "/proc/%i/exe", pid);
|
||||
|
||||
if (strcmp(pathname, "/proc/self/exe") == 0 || strcmp(pathname, PidSelfPath) == 0) {
|
||||
if (strcmp(pathname, "/proc/self/exe") == 0 ||
|
||||
strcmp(pathname, "/proc/thread-self/exe") == 0 ||
|
||||
strcmp(pathname, PidSelfPath) == 0) {
|
||||
auto App = Filename();
|
||||
strncpy(buf, App.c_str(), bufsiz);
|
||||
return std::min(bufsiz, App.size());
|
||||
|
||||
@@ -123,7 +123,9 @@ uint64_t ExecveHandler(const char *pathname, std::vector<const char*> &argv, std
|
||||
char PidSelfPath[50];
|
||||
snprintf(PidSelfPath, 50, "/proc/%i/exe", pid);
|
||||
|
||||
if (strcmp(pathname, "/proc/self/exe") == 0 || strcmp(pathname, PidSelfPath) == 0) {
|
||||
if (strcmp(pathname, "/proc/self/exe") == 0 ||
|
||||
strcmp(pathname, "/proc/thread-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();
|
||||
|
||||
Reference in new issue
Block a user