- timeout = dev->max_open_wait + (dev->max_part_size/(1350*1024/2));
-
- Dmsg2(29, "dvd_write_part: cmd=%s timeout=%d\n", ocmd.c_str(), timeout);
-
- {
- POOL_MEM results(PM_MESSAGE);
- sm_check(__FILE__, __LINE__, false);
- status = run_program_full_output(ocmd.c_str(), timeout, results.c_str());
- sm_check(__FILE__, __LINE__, false);
- if (status != 0) {
- Mmsg1(dev->errmsg, _("Error while writing current part to the DVD: %s"),
- results.c_str());
- Dmsg1(000, "%s", dev->errmsg);
- dev->dev_errno = EIO;
+
+ /* Explanation of the timeout value, when writing the first part,
+ * by Arno Lehmann :
+ * 9 GB, write speed 1x: 6990 seconds (almost 2 hours...)
+ * Overhead: 900 seconds (starting, initializing, finalizing,probably
+ * reloading 15 minutes)
+ * Sum: 15780.
+ * A reasonable last-exit timeout would be 16000 seconds. Quite long -
+ * almost 4.5 hours, but hopefully, that timeout will only ever be needed
+ * in case of a serious emergency.
+ */
+
+ if (dev->part == 1) {
+ timeout = 16000;
+ } else {
+ timeout = dev->max_open_wait + (dev->part_size/(1350*1024/4));
+ }
+
+ Dmsg2(20, "Write part: cmd=%s timeout=%d\n", ocmd.c_str(), timeout);
+ status = run_program_full_output(ocmd.c_str(), timeout, results.c_str());
+ Dmsg2(20, "Write part status=%d result=%s\n", status, results.c_str());
+
+ dev->blank_dvd = false;
+ if (status != 0) {
+ Jmsg2(dcr->jcr, M_FATAL, 0, _("Error writing part %d to the DVD: ERR=%s\n"),
+ dev->part, results.c_str());
+ Mmsg1(dev->errmsg, _("Error while writing current part to the DVD: %s"),
+ results.c_str());
+ Dmsg1(100, "%s\n", dev->errmsg);
+ dev->dev_errno = EIO;
+ if (!dev->truncating) {