]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/plugins.c
Add debug times, reduce size of two-pool-changer test
[bacula/bacula] / bacula / src / lib / plugins.c
index 1e55091652e1c7105721f81181d656f433068faf..84ea358ec80fa53e4d8c885ccf21f5bb523bffd5 100644 (file)
@@ -34,7 +34,7 @@
 #include "plugins.h"
 
 /* All loaded plugins */
-alist *plugin_list;
+alist *plugin_list = NULL;
 
 /*
  * Create a new plugin "class" entry and enter it in the
@@ -90,7 +90,7 @@ bool load_plugins(void *binfo, void *bfuncs, const char *plugin_dir, const char
    for ( ;; ) {
       if ((readdir_r(dp, entry, &result) != 0) || (result == NULL)) {
          if (!found) {
-            Jmsg(NULL, M_INFO, 0, _("Failed to find suitable plugin in %s\n"), 
+            Jmsg(NULL, M_INFO, 0, _("Failed to find any plugins in %s\n"), 
                   plugin_dir);
          }
          break;
@@ -103,6 +103,7 @@ bool load_plugins(void *binfo, void *bfuncs, const char *plugin_dir, const char
       len = strlen(result->d_name);
       type_len = strlen(type);
       if (len < type_len+1 || strcmp(&result->d_name[len-type_len], type) != 0) {
+         Dmsg3(100, "Rejected plugin: want=%s name=%s len=%d\n", type, result->d_name, len);
          continue;
       }
       Dmsg2(100, "Loaded plugin: name=%s len=%d\n", result->d_name, len);
@@ -164,6 +165,9 @@ void unload_plugins()
 #ifndef HAVE_WIN32
    Plugin *plugin;
 
+   if (!plugin_list) {
+      return;
+   }
    foreach_alist(plugin, plugin_list) {
       /* Shut it down and unload it */
       plugin->unloadPlugin();