Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nall: Retrieve executable path more reliably #1844

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

jcm93
Copy link
Contributor

@jcm93 jcm93 commented Feb 19, 2025

In a sandboxed Flatpak environment on Linux, the current dladdr strategy for retrieving the binary path seems to provide the bare executable name ares for dli_fname rather than the binary's full location. There don't seem to be any guarantees about what sort of path (relative or absolute) will be provided for dli_fname, so we shouldn't rely on it.

On platforms where /proc/self/exe is available, we can use that in conjunction with readlink instead.

If /proc/self/exe is not available, we will fall back to the current dladdr strategy. readlink, meanwhile, should be available on any *nix platform supported by ares.

Note

Verified that this strategy works for retrieving the sandboxed binary path inside a Flatpak (/app/bin/ares), as intended.

@LukeUsher LukeUsher merged commit 2c940b0 into ares-emulator:master Feb 21, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants