From: Fred Morcos Date: Fri, 27 Oct 2023 09:52:37 +0000 (+0200) Subject: Cleanup UeberBackend::loadModules X-Git-Tag: rec-5.0.0-beta1~16^2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61c1733fe06c5d7b9871276ea9b6f80256e44357;p=thirdparty%2Fpdns.git Cleanup UeberBackend::loadModules --- diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index bd41c69ea7..a2afd0be72 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include "dns.hh" #include "arguments.hh" @@ -76,19 +77,27 @@ bool UeberBackend::loadmodule(const string& name) bool UeberBackend::loadModules(const vector& modules, const string& path) { for (const auto& module : modules) { - bool res; + bool res = false; + if (module.find('.') == string::npos) { - res = UeberBackend::loadmodule(path + "/lib" + module + "backend.so"); + auto fullPath = path; + fullPath += "/lib"; + fullPath += module; + fullPath += "backend.so"; + res = UeberBackend::loadmodule(fullPath); } else if (module[0] == '/' || (module[0] == '.' && module[1] == '/') || (module[0] == '.' && module[1] == '.')) { // absolute or current path res = UeberBackend::loadmodule(module); } else { - res = UeberBackend::loadmodule(path + "/" + module); + auto fullPath = path; + fullPath += "/"; + fullPath += module; + res = UeberBackend::loadmodule(fullPath); } - if (res == false) { + if (!res) { return false; } }