]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/device.c
Make btape fill/unfill work
[bacula/bacula] / bacula / src / stored / device.c
index 9c34ea667cb9d8ee1f71f5369d185ddb5345bc30..c7a355b00dc8fe5817f1dbb6e1c40dbc70c48946 100644 (file)
@@ -107,6 +107,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
            unblock_device(dev);
            return 0;
         }
+        mjcr->VolFirstIndex = 0;      /* prevent writing jobmedia second time */
       }
 
       strcpy(dev->VolCatInfo.VolCatStatus, "Full");
@@ -119,13 +120,13 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       }
       Dmsg0(100, "Back from update_vol_info\n");
 
-      strcpy(PrevVolName, dev->VolCatInfo.VolCatName);
-      strcpy(dev->VolHdr.PrevVolName, PrevVolName);
+      bstrncpy(PrevVolName, dev->VolCatInfo.VolCatName, sizeof(PrevVolName));
+      bstrncpy(dev->VolHdr.PrevVolName, PrevVolName, sizeof(dev->VolHdr.PrevVolName));
 
       label_blk = new_block(dev);
 
-      /* Inform User about end of media */
-      Jmsg(jcr, M_INFO, 0, _("End of media on Volume %s Bytes=%s Blocks=%s.\n"), 
+      /* Inform User about end of medium */
+      Jmsg(jcr, M_INFO, 0, _("End of medium on Volume \"%s\" Bytes=%s Blocks=%s.\n"), 
           PrevVolName, edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, b1),
           edit_uint64_with_commas(dev->VolCatInfo.VolCatBlocks, b2));
 
@@ -136,7 +137,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       }
       P(dev->mutex);                 /* lock again */
 
-      Jmsg(jcr, M_INFO, 0, _("New volume %s mounted on device %s\n"),
+      Jmsg(jcr, M_INFO, 0, _("New volume \"%s\" mounted on device %s\n"),
         jcr->VolumeName, dev_name(dev));
 
       /* 
@@ -176,7 +177,8 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
            mjcr->StartBlock = (uint32_t)dev->file_addr;
            mjcr->StartFile  = (uint32_t)(dev->file_addr >> 32);
         }
-        mjcr->VolFirstFile = mjcr->JobFiles;
+        /* Set first FirstIndex for new Volume */
+        mjcr->VolFirstIndex = mjcr->JobFiles;
         mjcr->run_time += time(NULL) - wait_time; /* correct run time */
       }
       unblock_device(dev);