]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_cmds.c
Check if the ScratchPool points to the current Pool and print a warning message in...
[bacula/bacula] / bacula / src / dird / ua_cmds.c
index 33b93afcb4a1ddaca063998a6e9f2da62384bca7..d2e007b320126351d1d72a6215b5a15fce33df65 100644 (file)
@@ -197,7 +197,7 @@ static struct cmdstruct commands[] = {                                      /* C
        "\n\t pool=<pool> recycle=<yes/no> slot=<number>\n\t inchanger=<yes/no>"
        "\n\t maxvolbytes=<size> maxvolfiles=<nb> maxvoljobs=<nb>"
        "\n\t enabled=<yes/no> recyclepool=<pool> actiononpurge=<action>"
-       "\n\t allfrompool=<pool> fromallpools"),true},
+       "\n\t allfrompool=<pool> fromallpools frompool"),true},
  { NT_("use"),        use_cmd,       _("Use catalog xxx"), NT_("catalog=<catalog>"),     false},
  { NT_("var"),        var_cmd,       _("Does variable expansion"), NT_(""),  false},
  { NT_("version"),    version_cmd,   _("Print Director version"),  NT_(""),  true},
@@ -228,8 +228,10 @@ bool do_a_command(UAContext *ua)
       return false;
    }
 
-   while (ua->jcr->wstorage->size()) {
-      ua->jcr->wstorage->remove(0);
+   if (ua->jcr->wstorage) {
+      while (ua->jcr->wstorage->size()) {
+         ua->jcr->wstorage->remove(0);
+      }
    }
 
    len = strlen(ua->argk[0]);
@@ -527,6 +529,13 @@ int update_pool_references(JCR *jcr, BDB *db, POOL *pool)
 {
    POOL_DBR  pr;
 
+   if (pool->ScratchPool == pool) {
+      Jmsg(NULL, M_WARNING, 0,
+           _("The ScratchPool directive for Pool \"%s\" is incorrect. Using default Scratch pool instead.\n"),
+           pool->name());
+      pool->ScratchPool = NULL;
+   }
+
    if (!pool->RecyclePool && !pool->ScratchPool) {
       return 1;
    }
@@ -1840,7 +1849,7 @@ int wait_cmd(UAContext *ua, const char *cmd)
       for (bool running=true; running; ) {
          running = false;
          foreach_jcr(jcr) {
-            if (jcr->JobId != 0) {
+            if (!jcr->is_internal_job()) {
                running = true;
                break;
             }
@@ -1900,7 +1909,7 @@ int wait_cmd(UAContext *ua, const char *cmd)
       } else if (strcasecmp(ua->argk[i], "mount") == 0) {
          for (bool waiting=false; !waiting; ) {
             foreach_jcr(jcr) {
-               if (jcr->JobId != 0 &&
+               if (!jcr->is_internal_job() &&
                    (jcr->JobStatus == JS_WaitMedia || jcr->JobStatus == JS_WaitMount)) {
                   waiting = true;
                   break;