X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fbuffer.c;h=8dc6e88888dcb632c2b226b1737a5a8f77743a08;hb=3030a247b1e0d4ab25261107bed5ff4afb644b84;hp=a9660324d33e83eaeaef4f3ad230c4eaca3e9b17;hpb=95be2c50b429bfe7201590dd744864ab64c5d87e;p=chaz%2Ftar diff --git a/src/buffer.c b/src/buffer.c index a966032..8dc6e88 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -293,6 +293,7 @@ open_archive (enum access_mode wanted_access) { case ACCESS_READ: child_pid = sys_child_open_for_uncompress (); + read_full_records_option = false; break; case ACCESS_WRITE: @@ -310,7 +311,7 @@ open_archive (enum access_mode wanted_access) } else if (strcmp (archive_name_array[0], "-") == 0) { - read_full_records_option = 1; /* could be a pipe, be safe */ + read_full_records_option = true; /* could be a pipe, be safe */ if (verify_option) FATAL_ERROR ((0, 0, _("Cannot verify stdin/stdout archive"))); @@ -408,8 +409,10 @@ open_archive (enum access_mode wanted_access) else strcpy (record_start->header.name, volume_label_option); - assign_string (¤t_stat_info.file_name, record_start->header.name); - current_stat_info.had_trailing_slash = strip_trailing_slashes (current_stat_info.file_name); + assign_string (¤t_stat_info.file_name, + record_start->header.name); + current_stat_info.had_trailing_slash = + strip_trailing_slashes (current_stat_info.file_name); record_start->header.typeflag = GNUTYPE_VOLHDR; TIME_TO_CHARS (start_time, record_start->header.mtime); @@ -642,7 +645,7 @@ short_read (ssize_t status) /* FIXME: for size=0, multi-volume support. On the first record, warn about the problem. */ - if (!read_full_records_option && verbose_option + if (!read_full_records_option && verbose_option > 1 && record_start_block == 0 && status > 0) { unsigned long rsize = (record_size - left) / BLOCKSIZE; @@ -703,9 +706,14 @@ flush_read (void) return; } + /* The condition below used to include + || (status > 0 && !read_full_records_option) + This is incorrect since even if new_volume() succeeds, the + subsequent call to rmtread will overwrite the chunk of data + already read in the buffer, so the processing will fail */ + if ((status == 0 - || (status < 0 && errno == ENOSPC) - || (status > 0 && !read_full_records_option)) + || (status < 0 && errno == ENOSPC)) && multi_volume_option) { union block *cursor;