]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/sd_plugins.c
Make cd accept wildcards
[bacula/bacula] / bacula / src / stored / sd_plugins.c
index f142182a5c93cd84ac01bd20ce9e097691d291dc..8ea73af96e203f094452c72bcfefd856f5bbe93e 100644 (file)
@@ -104,13 +104,23 @@ int generate_plugin_event(JCR *jcr, bsdEventType eventType, void *value)
    bpContext *plugin_ctx;
    bsdEvent event;
    Plugin *plugin;
-   int i = 0;
+   int i;
    bRC rc = bRC_OK;
 
-   if (!bplugin_list || !jcr || !jcr->plugin_ctx_list) {
+   if (!bplugin_list) {
+      Dmsg0(dbglvl, "No bplugin_list: generate_plugin_event ignored.\n");
+      return bRC_OK;
+   }
+   if (!jcr) {
+      Dmsg0(dbglvl, "No jcr: generate_plugin_event ignored.\n");
+      return bRC_OK;
+   }
+   if (!jcr->plugin_ctx_list) {
+      Dmsg0(dbglvl, "No plugin_ctx_list: generate_plugin_event ignored.\n");
       return bRC_OK;                  /* Return if no plugins loaded */
    }
    if (jcr->is_job_canceled()) {
+      Dmsg0(dbglvl, "Cancel return from generate_plugin_event\n");
       return bRC_Cancel;
    }
 
@@ -241,7 +251,7 @@ static bool is_plugin_compatible(Plugin *plugin)
 void new_plugins(JCR *jcr)
 {
    Plugin *plugin;
-   int i = 0;
+   int i;
 
    Dmsg0(dbglvl, "=== enter new_plugins ===\n");
    if (!bplugin_list) {
@@ -251,6 +261,12 @@ void new_plugins(JCR *jcr)
    if (jcr->is_job_canceled()) {
       return;
    }
+   /*
+    * If plugins already loaded, just return
+    */
+   if (jcr->plugin_ctx_list) {
+      return;
+   }
 
    int num = bplugin_list->size();
 
@@ -282,7 +298,7 @@ void new_plugins(JCR *jcr)
 void free_plugins(JCR *jcr)
 {
    Plugin *plugin;
-   int i = 0;
+   int i;
 
    if (!bplugin_list || !jcr->plugin_ctx_list) {
       return;