"/etc/resolv.conf" assumed default path is wrong for termux #724
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
termux: the default path for resolv.conf file is not "/etc/resolv.conf", but the code presumes that to be the case
termux is a terminal app for android capable of running many linux utilites
the file resolv.conf is not found at the default location which therefore breaks other projects which use this one as a dependency
i ran accross this problem when trying to run the termux version of onionshare (https://github.com/oleanderxoxo/onidroid) which uses this library as a dependency somewhere downstream
i'm not sure what would be the most elegant solution to the resolv.conf location problem, but i've tested this code, and it works as a quickfix nonetheless
it checks if the $PREFIX environment variable is set and if it points to the termux app's "...data/files/usr" system path, then specifies explicitly the location of the resolv.conf file when creating the resolver object, which needs to be $PREFIX + "/etc/resolv.conf"