summaryrefslogtreecommitdiffstats
path: root/decode_lz.cc
diff options
context:
space:
mode:
Diffstat (limited to 'decode_lz.cc')
-rw-r--r--decode_lz.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/decode_lz.cc b/decode_lz.cc
index 4fc3d80..2bbb000 100644
--- a/decode_lz.cc
+++ b/decode_lz.cc
@@ -19,15 +19,11 @@
#include <algorithm>
#include <cerrno>
-#include <climits>
#include <cstdio>
#include <cstdlib>
-#include <cstring>
#include <queue>
-#include <string>
-#include <vector>
#include <pthread.h>
-#include <stdint.h>
+#include <stdint.h> // for lzlib.h
#include <unistd.h>
#include <utime.h>
#include <sys/stat.h>
@@ -37,8 +33,8 @@
#endif
#include <lzlib.h>
-#include "arg_parser.h"
#include "tarlz.h"
+#include "arg_parser.h"
#include "lzip_index.h"
#include "archive_reader.h"
@@ -610,11 +606,16 @@ extern "C" void * dworker( void * arg )
extended.fill_from_ustar( header ); // copy metadata from header
+ /* Skip members with an empty name in the ustar header. If there is an
+ extended header in a previous lzip member, its worker will request
+ mastership. Else the ustar-only unnamed member will be ignored. */
const char * msg;
if( check_skip_filename( cl_opts, name_pending, extended.path().c_str() ) )
msg = skip_member_lz( ar, courier, extended, i, worker_id );
else if( cl_opts.program_mode == m_list )
msg = list_member_lz( ar, courier, extended, header, rbuf, i, worker_id );
+ else if( extended.path().empty() )
+ msg = skip_member_lz( ar, courier, extended, i, worker_id );
else if( cl_opts.program_mode == m_diff )
msg = compare_member_lz( cl_opts, ar, courier, extended, header,
rbuf, i, worker_id );
@@ -657,7 +658,7 @@ void muxer( const char * const archive_namep, Packet_courier & courier )
}
if( !error && !courier.eof_found() ) // no worker found EOF blocks
{ show_file_error( archive_namep, end_msg ); error = true; }
- if( error ) cleanup_and_fail( 2 );
+ if( error ) exit_fail_mt( 2 );
}
} // end namespace
@@ -693,7 +694,7 @@ int decode_lz( const Cl_options & cl_opts, const Archive_descriptor & ad,
const int errcode =
pthread_create( &worker_threads[i], 0, dworker, &worker_args[i] );
if( errcode )
- { show_error( "Can't create worker threads", errcode ); cleanup_and_fail(); }
+ { show_error( "Can't create worker threads", errcode ); exit_fail_mt(); }
}
muxer( ad.namep, courier );
@@ -702,7 +703,7 @@ int decode_lz( const Cl_options & cl_opts, const Archive_descriptor & ad,
{
const int errcode = pthread_join( worker_threads[i], 0 );
if( errcode )
- { show_error( "Can't join worker threads", errcode ); cleanup_and_fail(); }
+ { show_error( "Can't join worker threads", errcode ); exit_fail_mt(); }
}
delete[] worker_threads;
delete[] worker_args;