Use android::base::Basename instead of basename

basename can have different behavior based on whether the glibc
or posix version is used, and musl doens't provide the glibc version
at all.  Avoid the problem by using the one in libbase instead.

Test: m USE_HOST_MUSL=true host-native -k
Change-Id: If17c7622ed9b9cffc218567a46afb059b608d3c9
This commit is contained in:
Colin Cross 2023-04-13 21:59:58 -07:00
parent 07f6f239ee
commit d459ccd14e

View file

@ -562,7 +562,7 @@ std::vector<std::string> Modprobe::ListModules(const std::string& pattern) {
// Attempt to match both the canonical module name and the module filename.
if (!fnmatch(pattern.c_str(), module.c_str(), 0)) {
rv.emplace_back(module);
} else if (!fnmatch(pattern.c_str(), basename(deps[0].c_str()), 0)) {
} else if (!fnmatch(pattern.c_str(), android::base::Basename(deps[0]).c_str(), 0)) {
rv.emplace_back(deps[0]);
}
}