/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2015 Kern Sibbald
- Copyright (C) 2001-2014 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2016 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
rhl = RECHDR1_LENGTH;
}
- if (block_len > 4000000) {
- Dmsg3(20, "!!!Dump block %s 0x%x blocksize too big %u\n", msg, b, block_len);
+ if (block_len > 4000000 || block_len < BLKHDR_CS_LENGTH) {
+ Dmsg4(20, "!!!Dump block %s %p blocksize too %s %lu\n",
+ msg, b,
+ (block_len < BLKHDR_CS_LENGTH)?"small":"big",
+ block_len);
return;
}
*/
block->buf_len = len;
block->buf = get_memory(block->buf_len);
- block->rechdr_queue = get_memory(block->buf_len);
block->rechdr_items = 0;
empty_block(block);
block->BlockVer = BLOCK_VER; /* default write version */
*/
void free_block(DEV_BLOCK *block)
{
- if (block) {
+ if (block && block->buf) {
Dmsg1(999, "free_block buffer %x\n", block->buf);
free_memory(block->buf);
- free_memory(block->rechdr_queue);
Dmsg1(999, "free_block block %x\n", block);
free_memory((POOLMEM *)block);
}
unser_uint32(BlockNumber);
unser_bytes(Id, BLKHDR_ID_LENGTH);
ASSERT(unser_length(block->buf) == BLKHDR1_LENGTH);
-
Id[BLKHDR_ID_LENGTH] = 0;
+
if (Id[3] == '1') {
bhl = BLKHDR1_LENGTH;
block->BlockVer = 1;
Dmsg0(100, "Canceled\n");
return false;
}
- /* Create a jobmedia record for this job */
- if (!dir_create_jobmedia_record(dcr)) {
+ /* If we wrote on Volume create a last jobmedia record for this job */
+ if (dcr->VolFirstIndex && !dir_create_jobmedia_record(dcr)) {
dcr->dev->dev_errno = EIO;
Jmsg2(jcr, M_FATAL, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
dcr->getVolCatName(), jcr->Job);