-/*
- *
- * 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"
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;
/* 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;
/* 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;
/*
* 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,
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;
}
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);