mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Treat EACCES for pid_running() as alive
When the user has some sort of hardening going on, we might not be able to read the Wine process's memory. In that case this check would return `false` even though the process is still running. To combat this, we should explicitly check for `EINVAL` which is returned when the file doesn't exist at all or when it's a broken 'symlink' (even though it isn't really a symlink).
This commit is contained in:
@@ -10,6 +10,11 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the process status detection treating a process as dead when the user
|
||||
doesn't have permissions to access the child process's memory. This fixes a
|
||||
seemingly very rare regression from yabridge 3.4.0 where the Wine plugin host
|
||||
application would immediately be seen as dead when using AppArmor, preventing
|
||||
yabridge from starting.
|
||||
- Fixed a regression from yabridge 3.4.0 where plugins with zero audio channels
|
||||
like FrozenPlain **Obelisk** would result in a crash.
|
||||
- Fixed a regression from yabridge 3.4.0 where JUCE-based VST3 plugins might
|
||||
|
||||
@@ -85,11 +85,16 @@ bool pid_running(pid_t pid) {
|
||||
// processes and zombies, and a terminated group host process will always be
|
||||
// left as a zombie process. If the process is active, then
|
||||
// `/proc/<pid>/{cwd,exe,root}` will be valid symlinks.
|
||||
try {
|
||||
fs::canonical("/proc/" + std::to_string(pid) + "/exe");
|
||||
return true;
|
||||
} catch (const fs::filesystem_error&) {
|
||||
// NOTE: We can get a `EACCES` here if we don't have permissions to read
|
||||
// this process's memory, so we should explicitly check for `EINVAL`
|
||||
// indicating that the 'symlink' is broken or just does not exist at
|
||||
// all.
|
||||
boost::system::error_code err;
|
||||
fs::canonical("/proc/" + std::to_string(pid) + "/exe", err);
|
||||
if (err && err.value() == EINVAL) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user