]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/read_record.c
added WSACleanup(), corrected WSA_Init() (removed #ifdef)
[bacula/bacula] / bacula / src / stored / read_record.c
index 277e5778a8e9cd8c05ba6204c00044e507b5c90b..64a3d6e49c9abe840cadac72516a29ce4eb5ab7a 100644 (file)
@@ -105,11 +105,16 @@ int read_records(JCR *jcr,  DEVICE *dev,
                  dev->file, dev_name(dev), jcr->VolumeName);
            continue;
         } else if (dev_state(dev, ST_SHORT)) {
-            Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
+            Jmsg1(jcr, M_ERROR, 0, "%s", dev->errmsg);
            continue;
         } else {
            /* I/O error or strange end of tape */
            display_tape_error_status(jcr, dev);
+           if (forge_on || jcr->ignore_label_errors) {
+              fsr_dev(dev, 1);       /* try skipping bad record */
+               Dmsg0(000, "Did fsr\n");
+              continue;              /* try to continue */
+           }
            ok = FALSE;
            break;
         }
@@ -130,7 +135,7 @@ int read_records(JCR *jcr,  DEVICE *dev,
        *   VolSessionId and VolSessionTime 
        */
       bool found = false;
-      for (rec=(DEV_RECORD *)recs->first(); rec; rec=(DEV_RECORD *)recs->next(rec)) {
+      foreach_dlist(rec, recs) {
         if (rec->VolSessionId == block->VolSessionId &&
             rec->VolSessionTime == block->VolSessionTime) {
            found = true;
@@ -236,11 +241,10 @@ int read_records(JCR *jcr,  DEVICE *dev,
 // Dmsg2(100, "Position=(file:block) %d:%d\n", dev->file, dev->block_num);
 
    /* Walk down list and free all remaining allocated recs */
-   for (rec=(DEV_RECORD *)recs->first(); rec; ) {
-      DEV_RECORD *nrec = (DEV_RECORD *)recs->next(rec);
+   while (!recs->empty()) {
+      rec = (DEV_RECORD *)recs->first();
       recs->remove(rec);
       free_record(rec);
-      rec = nrec;
    }
    delete recs;
    print_block_read_errors(jcr, block);
@@ -267,7 +271,7 @@ static int try_repositioning(JCR *jcr, DEV_RECORD *rec, DEVICE *dev)
       return 1;
    }    
    if (bsr) {
-      if (verbose > 1) {
+      if (verbose) {
          Jmsg(jcr, M_INFO, 0, "Reposition from (file:block) %d:%d to %d:%d\n",
            dev->file, dev->block_num, bsr->volfile->sfile,
            bsr->volblock->sblock);
@@ -344,19 +348,19 @@ static char *rec_state_to_str(DEV_RECORD *rec)
    static char buf[200]; 
    buf[0] = 0;
    if (rec->state & REC_NO_HEADER) {
-      strcat(buf, "Nohdr,");
+      bstrncat(buf, "Nohdr,", sizeof(buf));
    }
    if (is_partial_record(rec)) {
-      strcat(buf, "partial,");
+      bstrncat(buf, "partial,", sizeof(buf));
    }
    if (rec->state & REC_BLOCK_EMPTY) {
-      strcat(buf, "empty,");
+      bstrncat(buf, "empty,", sizeof(buf));
    }
    if (rec->state & REC_NO_MATCH) {
-      strcat(buf, "Nomatch,");
+      bstrncat(buf, "Nomatch,", sizeof(buf));
    }
    if (rec->state & REC_CONTINUATION) {
-      strcat(buf, "cont,");
+      bstrncat(buf, "cont,", sizeof(buf));
    }
    if (buf[0]) {
       buf[strlen(buf)-1] = 0;