archive = STDIN_FILENO;
- type = check_compressed_archive (archive);
+ type = check_compressed_archive ();
if (type != ct_none)
FATAL_ERROR ((0, 0,
_("Archive is compressed. Use %s option"),
{
char *input_buffer = NULL;
size_t size = 0;
-
- while (1)
+ bool stop;
+
+ while (!stop)
{
fputc ('\007', stderr);
fprintf (stderr,
case '?':
{
fprintf (stderr, _("\
- n [name] Give a new file name for the next (and subsequent) volume(s)\n\
+ n name Give a new file name for the next (and subsequent) volume(s)\n\
q Abort tar\n\
y or newline Continue operation\n"));
if (!restrict_option)
;
*cursor = '\0';
- /* FIXME: the following allocation is never reclaimed. */
- *archive_name_cursor = xstrdup (name);
+ if (name[0])
+ {
+ /* FIXME: the following allocation is never reclaimed. */
+ *archive_name_cursor = xstrdup (name);
+ stop = true;
+ }
+ else
+ fprintf (stderr, "%s",
+ _("File name not specified. Try again.\n"));
}
break;
}
static bool
-read_header0 ()
+read_header0 (struct tar_stat_info *info)
{
- enum read_header rc = read_header (false);
+ enum read_header rc;
+ tar_stat_init (info);
+ rc = read_header_primitive (false, info);
if (rc == HEADER_SUCCESS)
{
set_next_block_after (current_header);
{
size_t status;
union block *header;
-
+ struct tar_stat_info dummy;
+
switch (subcommand_option)
{
case APPEND_SUBCOMMAND:
header = find_next_block ();
if (!header)
return false;
+
switch (header->header.typeflag)
{
case XGLTYPE:
{
- struct tar_stat_info dummy;
- if (!read_header0 ())
+ if (!read_header0 (&dummy))
return false;
- tar_stat_init (&dummy);
xheader_decode (&dummy); /* decodes values from the global header */
tar_stat_destroy (&dummy);
if (!real_s_name)
}
case GNUTYPE_VOLHDR:
- if (!read_header0 ())
+ if (!read_header0 (&dummy))
return false;
+ tar_stat_destroy (&dummy);
assign_string (&volume_label, current_header->header.name);
set_next_block_after (header);
header = find_next_block ();
/* FALL THROUGH */
case GNUTYPE_MULTIVOL:
- if (!read_header0 ())
+ if (!read_header0 (&dummy))
return false;
+ tar_stat_destroy (&dummy);
assign_string (&continued_file_name, current_header->header.name);
continued_file_size =
UINTMAX_FROM_HEADER (current_header->header.size);
if (!continued_file_name
|| strcmp (continued_file_name, real_s_name))
{
- WARN ((0, 0, _("%s is not continued on this volume"),
- quote (real_s_name)));
- return false;
+ if ((archive_format == GNU_FORMAT || archive_format == OLDGNU_FORMAT)
+ && strlen (real_s_name) >= NAME_FIELD_SIZE
+ && strncmp (continued_file_name, real_s_name,
+ NAME_FIELD_SIZE) == 0)
+ WARN ((0, 0,
+ _("%s is possibly continued on this volume: header contains truncated name"),
+ quote (real_s_name)));
+ else
+ {
+ WARN ((0, 0, _("%s is not continued on this volume"),
+ quote (real_s_name)));
+ return false;
+ }
}
s = continued_file_size + continued_file_offset;