Skip to content

Commit

Permalink
Merge pull request #4357 from Sonicadvance1/fix_negative_return
Browse files Browse the repository at this point in the history
FileManagement: Throw a warning if `/proc` can't be opened
  • Loading branch information
Sonicadvance1 authored Feb 13, 2025
2 parents b76a296 + 116268b commit a7c6fdb
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/FileManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,15 @@ FileManager::FileManager(FEXCore::Context::Context* ctx)

// Keep an fd open for /proc, to bypass chroot-style sandboxes
ProcFD = open("/proc", O_RDONLY | O_CLOEXEC);

// Track the st_dev of /proc, to check for inode equality
struct stat Buffer;
auto Result = fstat(ProcFD, &Buffer);
if (Result >= 0) {
ProcFSDev = Buffer.st_dev;
if (ProcFD != -1) {
// Track the st_dev of /proc, to check for inode equality
struct stat Buffer;
auto Result = fstat(ProcFD, &Buffer);
if (Result >= 0) {
ProcFSDev = Buffer.st_dev;
}
} else {
LogMan::Msg::EFmt("Couldn't open `/proc`. Is ProcFS mounted? FEX won't be able to track FD conflicts");
}

UpdatePID(::getpid());
Expand Down

0 comments on commit a7c6fdb

Please sign in to comment.