if (mount_dvd(this, 1)) {
Dmsg0(99, "DVD device mounted.\n");
- if ((num_dvd_parts == 0) && (!truncating)) {
-#ifdef needed
+ if (num_dvd_parts == 0 && !truncating) {
/*
* If we can mount the device, and we are not truncating the DVD,
* we usually want to abort. There is one exception, if there is
clear_opened();
return;
}
-#endif
truncated_dvd = true;
}
} else {
bool first = true;
Dmsg3(400, "rewind res=%d fd=%d %s\n", reserved_device, fd, print_name());
+ state &= ~(ST_EOT|ST_EOF|ST_WEOT); /* remove EOF/EOT flags */
+ block_num = file = 0;
+ file_size = 0;
+ file_addr = 0;
if (fd < 0) {
if (!is_dvd()) { /* In case of major error, the fd is not open on DVD, so we don't want to abort. */
dev_errno = EBADF;
}
return false;
}
- state &= ~(ST_EOT|ST_EOF|ST_WEOT); /* remove EOF/EOT flags */
- block_num = file = 0;
- file_size = 0;
- file_addr = 0;
if (is_tape()) {
mt_com.mt_op = MTREW;
mt_com.mt_count = 1;
struct stat statp;
int part_save = part;
POOL_MEM archive_name(PM_FNAME);
+ int status;
part = num_dvd_parts;
- Dmsg3(100, "Remove empty part in close call make_dvd_filename. part=%d num=%d vol=%s\n",
- part, num_dvd_parts, VolCatInfo.VolCatName);
make_spooled_dvd_filename(this, archive_name);
/* Check that the part file is empty */
- if ((stat(archive_name.c_str(), &statp) == 0) && (statp.st_size == 0)) {
+ status = stat(archive_name.c_str(), &statp);
+ if (status == 0 && statp.st_size == 0) {
+ Dmsg3(100, "Unlink empty part in close call make_dvd_filename. part=%d num=%d vol=%s\n",
+ part, num_dvd_parts, VolCatInfo.VolCatName);
Dmsg1(100, "unlink(%s)\n", archive_name.c_str());
unlink(archive_name.c_str());
- }
+ set_part_spooled(false); /* no spooled part left */
+ } else if (status < 0) {
+ set_part_spooled(false); /* spool doesn't exit */
+ }
part = part_save; /* restore part number */
}
}
results = get_memory(2000);
results[0] = 0;
+
/* If busy retry each second */
+ Dmsg1(20, "do_mount run_prog=%s\n", ocmd.c_str());
while ((status = run_program_full_output(ocmd.c_str(),
max_open_wait/2, results)) != 0) {
/* Doesn't work with internationalisation (This is not a problem) */