+ POOL_MEM archive_name(PM_FNAME);
+
+ /*
+ * Don't write empty part files.
+ * This is only useful when growisofs does not support write beyond
+ * the 4GB boundary.
+ * Example :
+ * - 3.9 GB on the volume, dvd-freespace reports 0.4 GB free
+ * - Write 0.2 GB on the volume, Bacula thinks it could still
+ * append data, it creates a new empty part.
+ * - dvd-freespace reports 0 GB free, as the 4GB boundary has
+ * been crossed
+ * - Bacula thinks he must finish to write to the device, so it
+ * tries to write the last part (0-byte), but dvd-writepart fails...
+ *
+ * There is one exception: when recycling a volume, we write a blank part
+ * file, so, then, we need to accept to write it.
+ */
+ if (dev->part_size == 0 && !dev->truncating) {
+ Dmsg2(29, "dvd_write_part: device is %s, won't write blank part %d\n", dev->print_name(), dev->part);
+ /* Delete spool file */
+ make_spooled_dvd_filename(dev, archive_name);
+ unlink(archive_name.c_str());
+ dev->set_part_spooled(false);
+ Dmsg1(29, "========= unlink(%s)\n", archive_name.c_str());
+ sm_check(__FILE__, __LINE__, false);
+ return true;
+ }
+