From 2ff5d46dc35dd2242d49629f7062ca46ec3ff885 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 27 Mar 2020 14:25:09 +0000 Subject: Fix expanding module names. --- src/modules.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index 73bd2a5e2..2b83bc0d8 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -622,12 +622,13 @@ ServiceProvider* ModuleManager::FindService(ServiceType type, const std::string& std::string ModuleManager::ExpandModName(const std::string& modname) { - // Transform "callerid" -> "m_callerid.so" unless it already has a ".so" extension, - // so coremods in the "core_*.so" form aren't changed - std::string ret = modname; - if ((modname.length() < 3) || (modname.compare(modname.size() - 3, 3, ".so"))) - ret.insert(0, "m_").append(".so"); - return ret; + std::string fullname; + if (modname.compare(0, 5, "core_") != 0 && modname.compare(0, 2, "m_") != 0) + fullname.append("m_"); + fullname.append(modname); + if (modname.length() < 3 || modname.compare(modname.size() - 3, 3, ".so") != 0) + fullname.append(".so"); + return fullname; } dynamic_reference_base::dynamic_reference_base(Module* Creator, const std::string& Name) -- cgit v1.3.1-10-gc9f91