]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/dird_conf.c
Make another attempt to resolve bug #2176
[bacula/bacula] / bacula / src / dird / dird_conf.c
index 3a4b381f996ac434d1d1f87ffab9eac9589f06d2..5cad2b9d6b0e8eb7d51c6dba7531bbf2a0f17d68 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2015 Kern Sibbald
+   Copyright (C) 2000-2016 Kern Sibbald
 
    The original author of Bacula is Kern Sibbald, with contributions
    from many others, a complete list can be found in the file AUTHORS.
@@ -713,6 +713,9 @@ void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt,
       if (res->res_job.JobType == JT_MIGRATE || res->res_job.JobType == JT_COPY) {
          sendit(sock, _("     SelectionType=%d\n"), res->res_job.selection_type);
       }
+      if (res->res_job.JobType == JT_RESTORE) {
+         sendit(sock, _("     PrefixLinks=%d\n"), res->res_job.PrefixLinks);
+      }
       if (res->res_job.client) {
          sendit(sock, _("  --> "));
          dump_resource(-R_CLIENT, (RES *)res->res_job.client, sendit, sock);
@@ -1461,13 +1464,13 @@ void save_resource(int type, RES_ITEM *items, int pass)
       for (i=0; items[i].name; i++) {
          if (items[i].flags & ITEM_REQUIRED) {
             if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
-                Emsg2(M_ERROR_TERM, 0, _("%s item is required in %s resource, but not found.\n"),
-                    items[i].name, resources[rindex]);
+                Emsg2(M_ERROR_TERM, 0, _("\"%s\" directive is required in \"%s\" resource, but not found.\n"),
+                    items[i].name, resources[rindex].name);
             }
          }
          /* If this triggers, take a look at lib/parse_conf.h */
          if (i >= MAX_RES_ITEMS) {
-            Emsg1(M_ERROR_TERM, 0, _("Too many items in %s resource\n"), resources[rindex]);
+            Emsg1(M_ERROR_TERM, 0, _("Too many directive in \"%s\" resource\n"), resources[rindex].name);
          }
       }
    } else if (type == R_JOB) {
@@ -1476,8 +1479,8 @@ void save_resource(int type, RES_ITEM *items, int pass)
        */
       if (items[0].flags & ITEM_REQUIRED) {
          if (!bit_is_set(0, res_all.res_dir.hdr.item_present)) {
-             Emsg2(M_ERROR_TERM, 0, _("%s item is required in %s resource, but not found.\n"),
-                   items[0].name, resources[rindex]);
+             Emsg2(M_ERROR_TERM, 0, _("\"%s\" directive is required in \"%s\" resource, but not found.\n"),
+                   items[0].name, resources[rindex].name);
          }
       }
    }
@@ -1692,15 +1695,15 @@ void save_resource(int type, RES_ITEM *items, int pass)
       } else {
          RES *next, *last;
          if (res->res_dir.hdr.name == NULL) {
-            Emsg1(M_ERROR_TERM, 0, _("Name item is required in %s resource, but not found.\n"),
-                  resources[rindex]);
+            Emsg1(M_ERROR_TERM, 0, _("A Name directive is required in \"%s\" resource, but not found.\n"),
+                  resources[rindex].name);
          }
          /* Add new res to end of chain */
          for (last=next=res_head[rindex]; next; next=next->next) {
             last = next;
             if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
                Emsg2(M_ERROR_TERM, 0,
-                  _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
+                  _("Attempt to define second \"%s\" resource named \"%s\" is not permitted.\n"),
                   resources[rindex].name, res->res_dir.hdr.name);
             }
          }
@@ -2160,6 +2163,11 @@ extern "C" char *job_code_callback_director(JCR *jcr, const char* param)
 {
    static char yes[] = "yes";
    static char no[] = "no";
+   static char nothing[] = "";
+
+   if (jcr == NULL) {
+      return nothing;
+   }
    switch (param[0]) {
       case 'f':
          if (jcr->fileset) {
@@ -2188,7 +2196,7 @@ extern "C" char *job_code_callback_director(JCR *jcr, const char* param)
       case 'C':
          return jcr->cloned ? yes : no;
    }
-   return NULL;
+   return nothing;
 }
 
 bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code)