]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/job.c
Turn off debug
[bacula/bacula] / bacula / src / dird / job.c
index c76a1d7d8c5971e60848b2c76d2324e9a27a80c3..5e6a2334210fb828f5e485e06c85186b3fc79ab7 100644 (file)
@@ -1,11 +1,3 @@
-/*
- *
- *   Bacula Director Job processing routines
- *
- *     Kern Sibbald, October MM
- *
- *    Version $Id$
- */
 /*
    Bacula® - The Network Backup Solution
 
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*
+ *
+ *   Bacula Director Job processing routines
+ *
+ *     Kern Sibbald, October MM
+ *
+ *    Version $Id$
+ */
 
 #include "bacula.h"
 #include "dird.h"
@@ -59,7 +59,7 @@ void init_job_server(int max_workers)
 
    if ((stat = jobq_init(&job_queue, max_workers, job_thread)) != 0) {
       berrno be;
-      Emsg1(M_ABORT, 0, _("Could not init job queue: ERR=%s\n"), be.strerror(stat));
+      Emsg1(M_ABORT, 0, _("Could not init job queue: ERR=%s\n"), be.bstrerror(stat));
    }
    wd = new_watchdog();
    wd->callback = job_monitor_watchdog;
@@ -91,7 +91,7 @@ JobId_t run_job(JCR *jcr)
       /* Queue the job to be run */
       if ((stat = jobq_add(&job_queue, jcr)) != 0) {
          berrno be;
-         Jmsg(jcr, M_FATAL, 0, _("Could not add job queue: ERR=%s\n"), be.strerror(stat));
+         Jmsg(jcr, M_FATAL, 0, _("Could not add job queue: ERR=%s\n"), be.bstrerror(stat));
          return 0;
       }
       return jcr->JobId;
@@ -110,7 +110,7 @@ bool setup_job(JCR *jcr)
    /* Initialize termination condition variable */
    if ((errstat = pthread_cond_init(&jcr->term_wait, NULL)) != 0) {
       berrno be;
-      Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), be.strerror(errstat));
+      Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), be.bstrerror(errstat));
       goto bail_out;
    }
    jcr->term_wait_inited = true;
@@ -122,7 +122,7 @@ bool setup_job(JCR *jcr)
    /*
     * Open database
     */
-   Dmsg0(150, "Open database\n");
+   Dmsg0(100, "Open database\n");
    jcr->db=db_init_database(jcr, jcr->catalog->db_name, jcr->catalog->db_user,
                             jcr->catalog->db_password, jcr->catalog->db_address,
                             jcr->catalog->db_port, jcr->catalog->db_socket,
@@ -132,6 +132,7 @@ bool setup_job(JCR *jcr)
                  jcr->catalog->db_name);
       if (jcr->db) {
          Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+         db_close_database(jcr, jcr->db);
       }
       goto bail_out;
    }
@@ -801,14 +802,14 @@ void dird_free_jcr(JCR *jcr)
       pthread_cond_destroy(&jcr->term_wait);
       jcr->term_wait_inited = false;
    }
+   if (jcr->db_batch && jcr->db_batch != jcr->db) {
+      db_close_database(jcr, jcr->db_batch);
+   }
+   jcr->db_batch = NULL;
    if (jcr->db) {
       db_close_database(jcr, jcr->db);
       jcr->db = NULL;
    }
-   if (jcr->db_batch) {
-      db_close_database(jcr, jcr->db_batch);
-      jcr->db_batch = NULL;
-   }
    if (jcr->stime) {
       Dmsg0(200, "Free JCR stime\n");
       free_pool_memory(jcr->stime);