]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/restore.c
More cleanup
[bacula/bacula] / bacula / src / filed / restore.c
index a46f91dde46d0246849adf08cd43cb0b999ef888..f5d06e33258dc42134c95bf6d931845c032c15a4 100644 (file)
@@ -65,9 +65,10 @@ void do_restore(JCR *jcr)
    wherelen = strlen(jcr->where);
 
    sd = jcr->store_bsock;
-   jcr->JobStatus = JS_Running;
+   set_jcr_job_status(jcr, JS_Running);
 
    if (!bnet_set_buffer_size(sd, MAX_NETWORK_BUFFER_SIZE, BNET_SETBUF_READ)) {
+      set_jcr_job_status(jcr, JS_ErrorTerminated);
       return;
    }
    jcr->buf_size = sd->msglen;
@@ -126,7 +127,7 @@ void do_restore(JCR *jcr)
          */
         if (extract) {
            if (ofd < 0) {
-               Emsg0(M_ERROR, 0, _("Logic error output file should be open\n"));
+               Jmsg0(jcr, M_ERROR, 0, _("Logic error output file should be open\n"));
            }
            set_attributes(jcr, fname, ofile, lname, type, stream, 
                           &statp, attribsEx, &ofd);
@@ -359,7 +360,7 @@ void do_restore(JCR *jcr)
       } else if (extract) {
          Dmsg1(30, "Found wierd stream %d\n", stream);
         if (ofd < 0) {
-            Emsg0(M_ERROR, 0, _("Logic error output file should be open\n"));
+            Jmsg0(jcr, M_ERROR, 0, _("Logic error output file should be open\n"));
         }
         set_attributes(jcr, fname, ofile, lname, type, stream, 
                        &statp, attribsEx, &ofd);
@@ -376,11 +377,11 @@ void do_restore(JCR *jcr)
       set_attributes(jcr, fname, ofile, lname, type, stream, 
                     &statp, attribsEx, &ofd);
    }
-   jcr->JobStatus = JS_Terminated;
+   set_jcr_job_status(jcr, JS_Terminated);
    goto ok_out;
 
 bail_out:
-   jcr->JobStatus = JS_ErrorTerminated;
+   set_jcr_job_status(jcr, JS_ErrorTerminated);
 ok_out:
    if (jcr->compress_buf) {
       free(jcr->compress_buf);
@@ -417,19 +418,21 @@ static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct
    p = encode_time(statp->st_ctime, p);
    *p++ = ' ';
    *p++ = ' ';
-   for (f=fname; *f && (p-buf) < (int)sizeof(buf); )
+   for (f=fname; *f && (p-buf) < (int)sizeof(buf)-10; ) {
       *p++ = *f++;
+   }
    if (type == FT_LNK) {
       *p++ = ' ';
       *p++ = '-';
       *p++ = '>';
       *p++ = ' ';
       /* Copy link name */
-      for (f=lname; *f && (p-buf) < (int)sizeof(buf); )
+      for (f=lname; *f && (p-buf) < (int)sizeof(buf)-10; ) {
         *p++ = *f++;
+      }
    }
    *p++ = '\n';
    *p = 0;
    Dmsg0(20, buf);
-   Jmsg(jcr, M_INFO, 0, buf);
+   Jmsg(jcr, M_INFO, 0, "%s", buf);
 }