int32_t file_index, stream, last_file_index;
BSOCK *ds;
BSOCK *fd_sock = jcr->file_bsock;
- int ok = TRUE;
+ bool ok = true;
DEVICE *dev = jcr->device->dev;
DEV_RECORD rec;
DEV_BLOCK *block;
Jmsg1(jcr, M_FATAL, 0, _("Write session label failed. ERR=%s\n"),
strerror_dev(dev));
set_jcr_job_status(jcr, JS_ErrorTerminated);
- ok = FALSE;
+ ok = false;
}
}
Jmsg1(jcr, M_FATAL, 0, _("Error reading data header from FD. ERR=%s\n"),
bnet_strerror(ds));
- ok = FALSE;
+ ok = false;
break;
}
}
if (!B_ISSPACE(*p) || !B_ISDIGIT(*(p+1))) {
Jmsg1(jcr, M_FATAL, 0, _("Malformed data header from FD: %s\n"), ds->msg);
- ok = FALSE;
+ ok = false;
break;
}
stream = (int32_t)str_to_int64(p);
if (!(file_index > 0 && (file_index == last_file_index ||
file_index == last_file_index + 1))) {
Jmsg0(jcr, M_FATAL, 0, _("File index from FD not positive or sequential\n"));
- ok = FALSE;
+ ok = false;
break;
}
if (file_index != last_file_index) {
dev_name(dev), strerror_dev(dev));
Jmsg(jcr, M_FATAL, 0, _("Cannot fixup device error. %s\n"),
strerror_dev(dev));
- ok = FALSE;
+ ok = false;
break;
}
}
if (!dir_update_file_attributes(jcr, &rec)) {
Jmsg(jcr, M_FATAL, 0, _("Error updating file attributes. ERR=%s\n"),
bnet_strerror(jcr->dir_bsock));
- ok = FALSE;
+ ok = false;
jcr->dir_bsock->spool = 0;
break;
}
if (is_bnet_error(ds)) {
Jmsg1(jcr, M_FATAL, 0, _("Network error on data channel. ERR=%s\n"),
bnet_strerror(ds));
- ok = FALSE;
+ ok = false;
break;
}
}
- /*
- * We probably need a new flag that says "Do not attempt
- * to write because there is no tape".
- */
- Dmsg0(90, "Write_end_session_label()\n");
/* Create Job status for end of session label */
set_jcr_job_status(jcr, ok?JS_Terminated:JS_ErrorTerminated);
Jmsg1(jcr, M_FATAL, 0, _("Error writting end session label. ERR=%s\n"),
strerror_dev(dev));
set_jcr_job_status(jcr, JS_ErrorTerminated);
- ok = FALSE;
+ ok = false;
}
+ Dmsg0(90, "back from write_end_session_label()\n");
/* Flush out final partial block of this session */
if (!write_block_to_device(jcr, dev, block)) {
Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n"));
set_jcr_job_status(jcr, JS_ErrorTerminated);
- ok = FALSE;
+ ok = false;
}
}
- Dmsg1(200, "release device JobStatus=%d\n", jcr->JobStatus);
+ Dmsg1(200, "calling release device JobStatus=%d\n", jcr->JobStatus);
/* Release the device */
if (!release_device(jcr, dev)) {
Pmsg0(000, _("Error in release_device\n"));
set_jcr_job_status(jcr, JS_ErrorTerminated);
- ok = FALSE;
+ ok = false;
}
free_block(block);
static bool is_spooled(JCR *jcr)
{
- if (jcr->spool_attributes && jcr->dir_bsock->spool_fd) {
- return true;
- }
- return false;
+ return jcr->spool_attributes && jcr->dir_bsock->spool_fd;
}
static int begin_attribute_spool(JCR *jcr)
{
if (!jcr->no_attributes && jcr->spool_attributes) {
- return 0;
+ return open_spool_file(jcr, jcr->dir_bsock);
}
- return open_spool_file(jcr, jcr->dir_bsock);
+ return 1;
}
static int discard_attribute_spool(JCR *jcr)
{
- if (!is_spooled(jcr)) {
- return 0;
+ if (is_spooled(jcr)) {
+ return close_spool_file(jcr, jcr->dir_bsock);
}
- return close_spool_file(jcr, jcr->dir_bsock);
+ return 1;
}
static int commit_attribute_spool(JCR *jcr)
{
- if (!is_spooled(jcr)) {
- return 0;
+ if (is_spooled(jcr)) {
+ bnet_despool(jcr->dir_bsock);
+ return close_spool_file(jcr, jcr->dir_bsock);
}
- bnet_despool(jcr->dir_bsock);
- return close_spool_file(jcr, jcr->dir_bsock);
+ return 1;
}