summaryrefslogtreecommitdiffstats
path: root/delete_lz.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--delete_lz.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/delete_lz.cc b/delete_lz.cc
index 9b2b34f..2e536e3 100644
--- a/delete_lz.cc
+++ b/delete_lz.cc
@@ -39,8 +39,8 @@ int delete_members_lz( const Cl_options & cl_opts,
std::vector< char > & name_pending,
const int outfd )
{
+ Archive_reader_i ar( ad ); // indexed reader
Resizable_buffer rbuf;
- Archive_reader_i ar( ad ); // indexed reader
if( !rbuf.size() || ar.fatal() ) { show_error( mem_msg ); return 1; }
long long istream_pos = 0; // source of next data move
@@ -63,16 +63,17 @@ int delete_members_lz( const Cl_options & cl_opts,
}
if( !prev_extended ) member_begin = ar.data_pos();
Tar_header header;
- retval = ar.read( header, header_size );
- if( retval != 0 ) { show_file_error( ad.namep, ar.e_msg() ); goto done; }
- if( !verify_ustar_chksum( header ) )
+ if( ( retval = ar.read( header, header_size ) ) != 0 )
+ { show_file_error( ad.namep, ar.e_msg(), ar.e_code() ); goto done; }
+ if( !verify_ustar_chksum( header ) ) // error or EOA
{
- if( block_is_zero( header, header_size ) ) // EOF
+ if( block_is_zero( header, header_size ) ) // EOA
{
if( prev_extended && !cl_opts.permissive )
{ show_file_error( ad.namep, fv_msg1 ); retval = 2; }
goto done;
}
+ // indexed archive reader does not verify posix format
show_file_error( ad.namep, ( ar.data_pos() > header_size ) ?
bad_hdr_msg : posix_lz_msg );
retval = 2;
@@ -85,23 +86,21 @@ int delete_members_lz( const Cl_options & cl_opts,
if( prev_extended && !cl_opts.permissive )
{ show_file_error( ad.namep, fv_msg2 ); retval = 2; goto done; }
Extended dummy; // global headers are parsed and ignored
- retval = ar.parse_records( dummy, header, rbuf, true );
- if( retval == 0 ) continue;
- show_file_error( ad.namep, gblrec_msg );
- goto done;
+ retval = ar.parse_records( dummy, header, rbuf, gblrec_msg, true );
+ if( retval )
+ { show_file_error( ad.namep, ar.e_msg(), ar.e_code() ); goto done; }
+ continue;
}
if( typeflag == tf_extended )
{
- const char * msg = 0;
if( prev_extended && !cl_opts.permissive )
- { msg = fv_msg3; retval = 2; }
- else retval = ar.parse_records( extended, header, rbuf,
- cl_opts.permissive );
- if( retval == 0 && !extended.crc_present() && cl_opts.missing_crc )
- { msg = mcrc_msg; retval = 2; }
- if( retval == 0 ) { prev_extended = true; continue; }
- show_file_error( ad.namep, msg ? msg : extrec_msg );
- goto done;
+ { show_file_error( ad.namep, fv_msg3 ); retval = 2; goto done; }
+ if( ( retval = ar.parse_records( extended, header, rbuf, extrec_msg,
+ cl_opts.permissive ) ) != 0 )
+ { show_file_error( ad.namep, ar.e_msg(), ar.e_code() ); goto done; }
+ if( !extended.crc_present() && cl_opts.missing_crc )
+ { show_file_error( ad.namep, miscrc_msg ); retval = 2; goto done; }
+ prev_extended = true; continue;
}
prev_extended = false;
@@ -112,6 +111,7 @@ int delete_members_lz( const Cl_options & cl_opts,
// delete tar member
if( !check_skip_filename( cl_opts, name_pending, extended.path().c_str() ) )
{
+ print_removed_prefix( extended.removed_prefix );
// verify that members match
if( member_begin != ad.lzip_index.dblock( i ).pos() || !ar.at_member_end() )
{ show_file_error( extended.path().c_str(),