From d459ccd14e8fcb8134f8ca97045702f46b3e5657 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 13 Apr 2023 21:59:58 -0700 Subject: [PATCH] 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 --- libmodprobe/libmodprobe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmodprobe/libmodprobe.cpp b/libmodprobe/libmodprobe.cpp index e071c96d9..1971f01d2 100644 --- a/libmodprobe/libmodprobe.cpp +++ b/libmodprobe/libmodprobe.cpp @@ -562,7 +562,7 @@ std::vector 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]); } }