summaryrefslogtreecommitdiffstats
path: root/ztest.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:37:59 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:37:59 +0000
commit5a8338a2537d1aca007fee7d5c1927b3a83c2da3 (patch)
tree36348dba6840228936b5152149ea57802a0bc81b /ztest.cc
parentAdding debian version 1.3~pre1-1. (diff)
downloadzutils-5a8338a2537d1aca007fee7d5c1927b3a83c2da3.tar.xz
zutils-5a8338a2537d1aca007fee7d5c1927b3a83c2da3.zip
Merging upstream version 1.3~pre2.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
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)