diff --git a/External/FEXCore/Source/Interface/HLE/FileManagement.cpp b/External/FEXCore/Source/Interface/HLE/FileManagement.cpp index e80be7ad2..50dfb51a4 100644 --- a/External/FEXCore/Source/Interface/HLE/FileManagement.cpp +++ b/External/FEXCore/Source/Interface/HLE/FileManagement.cpp @@ -140,11 +140,11 @@ uint64_t FileManager::Openat([[maybe_unused]] int dirfs, const char *pathname, i if (fd == -1) fd = ::openat(dirfs, pathname, flags, mode); - - return fd; } - FDToNameMap[fd] = pathname; + if (fd != -1) + FDToNameMap[fd] = pathname; + return fd; }