]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/filed/accurate.c
Ensure that StorageId is updated after write
[bacula/bacula] / bacula / src / filed / accurate.c
index 77866a82d380d7e7f7eb7f33e0c1ad107c57c8a2..04bbfe43ab168b851f7012710d2d341221a31c57 100644 (file)
@@ -116,7 +116,7 @@ static bool accurate_send_base_file_list(JCR *jcr)
       if (elt->seen) {
          Dmsg2(dbglvl, "base file fname=%s seen=%i\n", elt->fname, elt->seen);
          /* TODO: skip the decode and use directly the lstat field */
-         decode_stat(elt->lstat, &statc, &LinkFIc); /* decode catalog stat */  
+         decode_stat(elt->lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */  
          ff_pkt->fname = elt->fname;
          ff_pkt->statp = statc;
          encode_and_send_attributes(jcr, ff_pkt, stream);
@@ -158,7 +158,7 @@ static bool accurate_send_deleted_list(JCR *jcr)
       }
       Dmsg2(dbglvl, "deleted fname=%s seen=%i\n", elt->fname, elt->seen);
       /* TODO: skip the decode and use directly the lstat field */
-      decode_stat(elt->lstat, &statc, &LinkFIc); /* decode catalog stat */
+      decode_stat(elt->lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */
       ff_pkt->fname = elt->fname;
       ff_pkt->statp.st_mtime = statc.st_mtime;
       ff_pkt->statp.st_ctime = statc.st_ctime;
@@ -212,8 +212,10 @@ static bool accurate_add_file(JCR *jcr, uint32_t len,
    bool ret = true;
    CurFile *item;
 
-   /* we store CurFile, fname and ctime/mtime in the same chunk */
-   item = (CurFile *)jcr->file_list->hash_malloc(sizeof(CurFile)+len);
+   /* we store CurFile, fname and ctime/mtime in the same chunk 
+    * we need one extra byte to handle an empty chksum
+    */
+   item = (CurFile *)jcr->file_list->hash_malloc(sizeof(CurFile)+len+3);
    item->seen = 0;
 
    /* TODO: see if we can optimize this part with memcpy instead of strcpy */
@@ -257,6 +259,7 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt)
    CurFile elt;
 
    ff_pkt->delta_seq = 0;
+   ff_pkt->accurate_found = false;
 
    if (!jcr->accurate && !jcr->rerunning) {
       return true;
@@ -276,14 +279,10 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt)
       goto bail_out;
    }
 
+   ff_pkt->accurate_found = true;
    ff_pkt->delta_seq = elt.delta_seq;
 
-   if (elt.seen) { /* file has been seen ? */
-      Dmsg1(dbglvl, "accurate %s (already seen)\n", fname);
-      goto bail_out;
-   }
-
-   decode_stat(elt.lstat, &statc, &LinkFIc); /* decode catalog stat */
+   decode_stat(elt.lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */
 
    if (!jcr->rerunning && (jcr->getJobLevel() == L_FULL)) {
       opts = ff_pkt->BaseJobOpts;
@@ -378,7 +377,9 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt)
             stat = true;
          }
          break;
-
+      case 'A':                 /* Always backup a file */
+         stat = true;
+         break;
       /* TODO: cleanup and factorise this function with verify.c */
       case '5':                /* compare MD5 */
       case '1':                /* compare SHA1 */