]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug #180 ERR=success in btape when tape error
authorKern Sibbald <kern@sibbald.com>
Sat, 17 May 2014 15:56:53 +0000 (17:56 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 26 Jul 2014 08:30:10 +0000 (10:30 +0200)
bacula/src/stored/bls.c
bacula/src/stored/btape.c

index ce8e53f82266c66fafc965f2e80451e981988835..3ee9604c678ebb847b44c4adc9bd5f06663a8794 100644 (file)
@@ -273,7 +273,7 @@ static void do_blocks(char *infname)
    char buf1[100], buf2[100];
    for ( ;; ) {
       if (!dcr->read_block_from_device(NO_BLOCK_NUMBER_CHECK)) {
-         Dmsg1(100, "!read_block(): ERR=%s\n", dev->bstrerror());
+         Dmsg1(100, "!read_block(): ERR=%s\n", dev->print_errmsg());
          if (dev->at_eot()) {
             if (!mount_next_read_volume(dcr)) {
                Jmsg(jcr, M_INFO, 0, _("Got EOM at file %u on device %s, Volume \"%s\"\n"),
@@ -294,7 +294,7 @@ static void do_blocks(char *infname)
             Dmsg0(20, "read_record got eof. try again\n");
             continue;
          } else if (dev->is_short_block()) {
-            Jmsg(jcr, M_INFO, 0, "%s", dev->errmsg);
+            Jmsg(jcr, M_INFO, 0, "%s", dev->print_errmsg());
             continue;
          } else {
             /* I/O error */
index 3ca97ffcb631bca590ffb4de5a5b9338d2379471..109294be968ef1ca20268cedfe9ddc47c01e78ca 100644 (file)
@@ -462,7 +462,7 @@ static bool open_the_device()
    dev->rLock(false);
    Dmsg1(200, "Opening device %s\n", dcr->VolumeName);
    if (!dev->open(dcr, OPEN_READ_WRITE)) {
-      Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
+      Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->print_errmsg());
       ok = false;
       goto bail_out;
    }
@@ -524,7 +524,7 @@ static void readlabelcmd()
       Pmsg1(0, _("I/O error on device: ERR=%s"), dev->bstrerror());
       break;
    case VOL_TYPE_ERROR:
-      Pmsg1(0, _("Volume type error: ERR=%s\n"), dev->errmsg);
+      Pmsg1(0, _("Volume type error: ERR=%s\n"), dev->print_errmsg());
       break;
    case VOL_NAME_ERROR:
       Pmsg0(0, _("Volume name error\n"));
@@ -853,8 +853,7 @@ static bool re_read_block_test()
    }
    Pmsg0(0, _("Backspace record OK.\n"));
    if (!dcr->read_block_from_dev(NO_BLOCK_NUMBER_CHECK)) {
-      berrno be;
-      Pmsg1(0, _("Read block failed! ERR=%s\n"), be.bstrerror(dev->dev_errno));
+      Pmsg1(0, _("Read block failed! ERR=%s\n"), dev->print_errmsg());
       goto bail_out;
    }
    memset(rec->data, 0, rec->data_len);
@@ -1219,14 +1218,13 @@ static bool write_read_test()
    for (i=1; i<=2*num_recs; i++) {
 read_again:
       if (!dcr->read_block_from_dev(NO_BLOCK_NUMBER_CHECK)) {
-         berrno be;
          if (dev_state(dev, ST_EOF)) {
             Pmsg0(-1, _("Got EOF on tape.\n"));
             if (i == num_recs+1) {
                goto read_again;
             }
          }
-         Pmsg2(0, _("Read block %d failed! ERR=%s\n"), i, be.bstrerror(dev->dev_errno));
+         Pmsg2(0, _("Read block %d failed! ERR=%s\n"), i, dev->print_errmsg());
          goto bail_out;
       }
       memset(rec->data, 0, rec->data_len);
@@ -1338,7 +1336,6 @@ static bool position_test()
       }
 read_again:
       if (!dcr->read_block_from_dev(NO_BLOCK_NUMBER_CHECK)) {
-         berrno be;
          if (dev_state(dev, ST_EOF)) {
             Pmsg0(-1, _("Got EOF on tape.\n"));
             if (!got_eof) {
@@ -1347,7 +1344,7 @@ read_again:
             }
          }
          Pmsg4(0, _("Read block %d failed! file=%d blk=%d. ERR=%s\n\n"),
-            recno, file, blk, be.bstrerror(dev->dev_errno));
+            recno, file, blk, dev->print_errmsg());
          Pmsg0(0, _("This may be because the tape drive block size is not\n"
                     " set to variable blocking as normally used by Bacula.\n"
                     " Please see the Tape Testing chapter in the manual and \n"
@@ -2088,7 +2085,7 @@ static void scan_blocks()
             printf(_("Short block read.\n"));
             continue;
          }
-         printf(_("Error reading block. ERR=%s\n"), dev->bstrerror());
+         printf(_("Error reading block. ERR=%s\n"), dev->print_errmsg());
          goto bail_out;
       }
       if (block->block_len != block_size) {
@@ -2526,7 +2523,7 @@ static bool do_unfill()
    dev->close();
    dev->num_writers = 0;
    if (!acquire_device_for_read(dcr)) {
-      Pmsg1(-1, "%s", dev->errmsg);
+      Pmsg1(-1, "%s", dev->print_errmsg());
       goto bail_out;
    }
    /*
@@ -2551,7 +2548,7 @@ static bool do_unfill()
    }
    Pmsg1(-1, _("Reading block %u.\n"), last_block_num);
    if (!dcr->read_block_from_device(NO_BLOCK_NUMBER_CHECK)) {
-      Pmsg1(-1, _("Error reading block: ERR=%s\n"), dev->bstrerror());
+      Pmsg1(-1, _("Error reading block: ERR=%s\n"), dev->print_errmsg());
       goto bail_out;
    }
    if (compare_blocks(last_block, block)) {
@@ -2589,7 +2586,7 @@ static bool do_unfill()
 
    dev->clear_read();
    if (!acquire_device_for_read(dcr)) {
-      Pmsg1(-1, "%s", dev->errmsg);
+      Pmsg1(-1, "%s", dev->print_errmsg());
       goto bail_out;
    }
 
@@ -2603,7 +2600,7 @@ static bool do_unfill()
    }
    Pmsg1(-1, _("Reading block %d.\n"), dev->block_num);
    if (!dcr->read_block_from_device(NO_BLOCK_NUMBER_CHECK)) {
-      Pmsg1(-1, _("Error reading block: ERR=%s\n"), dev->bstrerror());
+      Pmsg1(-1, _("Error reading block: ERR=%s\n"), dev->print_errmsg());
       goto bail_out;
    }
    if (compare_blocks(first_block, block)) {
@@ -2619,7 +2616,7 @@ static bool do_unfill()
    }
    Pmsg1(-1, _("Reading block %d.\n"), dev->block_num);
    if (!dcr->read_block_from_device(NO_BLOCK_NUMBER_CHECK)) {
-      Pmsg1(-1, _("Error reading block: ERR=%s\n"), dev->bstrerror());
+      Pmsg1(-1, _("Error reading block: ERR=%s\n"), dev->print_errmsg());
       goto bail_out;
    }
    if (compare_blocks(last_block, block)) {
@@ -3039,7 +3036,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr, bool /* writing */)
    if (dcr->VolumeName[0] == 0) {
       return dir_ask_sysop_to_create_appendable_volume(dcr);
    }
-   Pmsg1(-1, "%s", dev->errmsg);           /* print reason */
+   Pmsg1(-1, "%s", dev->print_errmsg());           /* print reason */
    if (dcr->VolumeName[0] == 0 || strcmp(dcr->VolumeName, "TestVolume2") == 0) {
       fprintf(stderr, _("Mount second Volume on device %s and press return when ready: "),
          dev->print_name());