]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/job.c
Fix line I accidently truncated
[bacula/bacula] / bacula / src / dird / job.c
index f4eceadeb8e676b6663f4658467a12a05136f4e0..b158ce2d1fd7eaeb74b64947bc03f465381d898f 100644 (file)
@@ -156,6 +156,10 @@ bool setup_job(JCR *jcr)
     * Create Job record
     */
    init_jcr_job_record(jcr);
+   if (!get_or_create_client_record(jcr)) {
+      goto bail_out;
+   }
+
    if (!db_create_job_record(jcr, jcr->db, &jcr->jr)) {
       Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
       goto bail_out;
@@ -164,10 +168,6 @@ bool setup_job(JCR *jcr)
    Dmsg4(100, "Created job record JobId=%d Name=%s Type=%c Level=%c\n",
        jcr->JobId, jcr->Job, jcr->jr.JobType, jcr->jr.JobLevel);
 
-   if (!get_or_create_client_record(jcr)) {
-      goto bail_out;
-   }
-
    generate_daemon_event(jcr, "JobStart");
 
    if (job_canceled(jcr)) {
@@ -554,7 +554,7 @@ static bool job_check_maxwaittime(JCR *control_jcr, JCR *jcr)
             jcr->JobStatus);
    }
    Dmsg3(800, "MaxWaitTime result: %scancel JCR %p (%s)\n",
-         cancel ? "" : "do not ", jcr, jcr->job);
+         cancel ? "" : "do not ", jcr, jcr->Job);
 #endif
    return cancel;
 }
@@ -565,8 +565,6 @@ static bool job_check_maxwaittime(JCR *control_jcr, JCR *jcr)
  */
 static bool job_check_maxruntime(JCR *control_jcr, JCR *jcr)
 {
-   bool cancel = false;
-
    if (jcr->job->MaxRunTime == 0 || job_canceled(jcr)) {
       return false;
    }
@@ -604,9 +602,9 @@ static bool job_check_maxruntime(JCR *control_jcr, JCR *jcr)
    }
 
    Dmsg3(200, "MaxRunTime result: %scancel JCR %p (%s)\n",
-         cancel ? "" : "do not ", jcr, jcr->job);
+         cancel ? "" : "do not ", jcr, jcr->Job);
 #endif
-   return cancel;
+   return true;
 }
 
 /*
@@ -852,11 +850,6 @@ void dird_free_jcr_pointers(JCR *jcr)
       free_pool_memory(jcr->fname);
       jcr->fname = NULL;
    }
-   if (jcr->stime) {
-      Dmsg0(200, "Free JCR stime\n");
-      free_pool_memory(jcr->stime);
-      jcr->stime = NULL;
-   }
    if (jcr->RestoreBootstrap) {
       free(jcr->RestoreBootstrap);
       jcr->RestoreBootstrap = NULL;
@@ -889,6 +882,19 @@ void dird_free_jcr(JCR *jcr)
       pthread_cond_destroy(&jcr->term_wait);
       jcr->term_wait_inited = false;
    }
+   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);
+      jcr->stime = NULL;
+   }
    if (jcr->fname) {
       Dmsg0(200, "Free JCR fname\n");
       free_pool_memory(jcr->fname);