]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Cleanup UeberBackend::loadModules
authorFred Morcos <fred.morcos@open-xchange.com>
Fri, 27 Oct 2023 09:52:37 +0000 (11:52 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Fri, 27 Oct 2023 09:52:37 +0000 (11:52 +0200)
pdns/ueberbackend.cc

index bd41c69ea7d3c321793851e992cdf75d3c770346..a2afd0be72a4bf4683bfd2a27f60c6b0bd281cdb 100644 (file)
@@ -38,6 +38,7 @@
 #include <iostream>
 #include <sstream>
 #include <functional>
+#include <string>
 
 #include "dns.hh"
 #include "arguments.hh"
@@ -76,19 +77,27 @@ bool UeberBackend::loadmodule(const string& name)
 bool UeberBackend::loadModules(const vector<string>& 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;
     }
   }