]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/fd_cmds.c
Use the command line utility dropdb instead of the psql command
[bacula/bacula] / bacula / src / stored / fd_cmds.c
index 9987753720eef5babe33449bc702771dcc52936a..e7129a25f301d3453eebf851914c31751dd6faca 100644 (file)
@@ -111,8 +111,8 @@ void run_job(JCR *jcr)
    char ec1[30];
 
 
-   fd->jcr = (void *)jcr;
-   dir->jcr = (void *)jcr;
+   fd->jcr = jcr;
+   dir->jcr = jcr;
    Dmsg1(120, "Start run Job=%s\n", jcr->Job);
    bnet_fsend(dir, Job_start, jcr->Job); 
    jcr->start_time = time(NULL);
@@ -153,7 +153,6 @@ void run_job(JCR *jcr)
    set_jcr_job_status(jcr, JS_Terminated);
    bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
       edit_uint64(jcr->JobBytes, ec1));
-
    bnet_sig(dir, BNET_EOD);          /* send EOD to Director daemon */
    return;
 }
@@ -171,9 +170,9 @@ static int append_data_cmd(JCR *jcr)
    Dmsg1(120, "Append data: %s", fd->msg);
    if (jcr->session_opened) {
       Dmsg1(110, "<bfiled: %s", fd->msg);
+      jcr->JobType = JT_BACKUP;
       if (do_append_data(jcr)) {
         bnet_fsend(fd, OK_append);
-        jcr->JobType = JT_BACKUP;
         return 1;
       } else {
         bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
@@ -195,6 +194,7 @@ static int append_end_session(JCR *jcr)
       bnet_fsend(fd, NOT_opened);
       return 0;
    }
+   set_jcr_job_status(jcr, JS_Terminated);
    return bnet_fsend(fd, OK_end);
 }
 
@@ -239,7 +239,7 @@ static int append_close_session(JCR *jcr)
    }
    /* Send final statistics to File daemon */
    bnet_fsend(fd, OK_close, jcr->JobStatus);
-   Dmsg1(160, ">filed: %s\n", fd->msg);
+   Dmsg1(120, ">filed: %s\n", fd->msg);
 
    bnet_sig(fd, BNET_EOD);           /* send EOD to File daemon */
        
@@ -317,6 +317,7 @@ static int bootstrap_cmd(JCR *jcr)
    BSOCK *fd = jcr->file_bsock;
    POOLMEM *fname = get_pool_memory(PM_FNAME);
    FILE *bs;
+   int stat = 0;
 
    if (jcr->RestoreBootstrap) {
       unlink(jcr->RestoreBootstrap);
@@ -343,17 +344,20 @@ static int bootstrap_cmd(JCR *jcr)
       goto bail_out;
    }
    if (debug_level > 20) {
-      dump_bsr(jcr->bsr);
+      dump_bsr(jcr->bsr, true);
    }
-   return bnet_fsend(fd, OK_bootstrap);
+   stat = 1;
 
 bail_out:
    unlink(jcr->RestoreBootstrap);
    free_pool_memory(jcr->RestoreBootstrap);
    jcr->RestoreBootstrap = NULL;
-   bnet_fsend(fd, ERROR_bootstrap);
-   return 0;
-
+   if (stat) {
+      return bnet_fsend(fd, OK_bootstrap);
+   } else {
+      bnet_fsend(fd, ERROR_bootstrap);
+      return 0;
+   }
 }