summaryrefslogtreecommitdiffstats
path: root/ztest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ztest.cc')
-rw-r--r--ztest.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/ztest.cc b/ztest.cc
index 86a8518..cb78eb1 100644
--- a/ztest.cc
+++ b/ztest.cc
@@ -152,13 +152,24 @@ int ztest_file( const int infd, int format_index,
const std::string & input_filename,
const std::vector< const char * > & ztest_args )
{
+ static int disable_xz = -1; // tri-state bool
const uint8_t * magic_data = 0;
int magic_size = 0;
if( format_index < 0 )
format_index = test_format( infd, &magic_data, &magic_size );
const char * const compressor_name = get_compressor_name( format_index );
if( !compressor_name )
- return 0; // skip this file
+ return 0; // ignore this file
+ if( format_index == fmt_xz )
+ {
+ if( disable_xz < 0 )
+ {
+ std::string command( compressor_name ); command += " -V > /dev/null";
+ disable_xz = ( std::system( command.c_str() ) != 0 );
+ }
+ if( disable_xz ) return 0; // ignore this file if no xz installed
+ }
+
const pid_t pid = fork();
if( pid == 0 ) // child (compressor)