+ /* We're multivol. Panic if we didn't get the right kind of response. */
+
+ /* ENXIO is for the UNIX PC. */
+ if (status < 0 && errno != ENOSPC && errno != EIO && errno != ENXIO)
+ archive_write_error (status);
+
+ /* If error indicates a short write, we just move to the next tape. */
+
+ if (!new_volume (ACCESS_WRITE))
+ return;
+
+ if (totals_option)
+ prev_written += bytes_written;
+ bytes_written = 0;
+
+ if (volume_label_option && real_s_name)
+ {
+ copy_back = 2;
+ record_start -= 2;
+ }
+ else if (volume_label_option || real_s_name)
+ {
+ copy_back = 1;
+ record_start--;
+ }
+ else
+ copy_back = 0;
+
+ if (volume_label_option)
+ {
+ memset (record_start, 0, BLOCKSIZE);
+ sprintf (record_start->header.name, "%s Volume %d",
+ volume_label_option, volno);
+ TIME_TO_CHARS (start_time, record_start->header.mtime);
+ record_start->header.typeflag = GNUTYPE_VOLHDR;
+ finish_header (record_start, -1);
+ }
+
+ if (real_s_name)
+ {
+ int tmp;
+
+ if (volume_label_option)
+ record_start++;
+
+ memset (record_start, 0, BLOCKSIZE);
+
+ /* FIXME: Michael P Urban writes: [a long name file] is being written
+ when a new volume rolls around [...] Looks like the wrong value is
+ being preserved in real_s_name, though. */
+
+ strcpy (record_start->header.name, real_s_name);
+ record_start->header.typeflag = GNUTYPE_MULTIVOL;
+ OFF_TO_CHARS (real_s_sizeleft, record_start->header.size);
+ OFF_TO_CHARS (real_s_totsize - real_s_sizeleft,
+ record_start->oldgnu_header.offset);
+ tmp = verbose_option;
+ verbose_option = 0;
+ finish_header (record_start, -1);
+ verbose_option = tmp;
+
+ if (volume_label_option)
+ record_start--;
+ }
+
+ status = write_archive_buffer ();
+ if (status != record_size)
+ archive_write_error (status);
+
+ bytes_written += status;
+
+ if (copy_back)
+ {
+ record_start += copy_back;
+ memcpy (current_block,
+ record_start + blocking_factor - copy_back,
+ copy_back * BLOCKSIZE);
+ current_block += copy_back;
+
+ if (real_s_sizeleft >= copy_back * BLOCKSIZE)
+ real_s_sizeleft -= copy_back * BLOCKSIZE;
+ else if ((real_s_sizeleft + BLOCKSIZE - 1) / BLOCKSIZE <= copy_back)
+ assign_string (&real_s_name, 0);
+ else
+ {
+ assign_string (&real_s_name, safer_name_suffix (save_name, 0));
+ real_s_sizeleft = save_sizeleft;
+ real_s_totsize = save_totsize;