summaryrefslogtreecommitdiffstats
path: root/ztest.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:18:52 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:18:52 +0000
commit6a83373eb86eec673be2d24fe840a9bce97fcaaa (patch)
tree5af649b83e4681c1da7b99fb6f15025d6e04c7a2 /ztest.cc
parentAdding upstream version 0.8. (diff)
downloadzutils-6a83373eb86eec673be2d24fe840a9bce97fcaaa.tar.xz
zutils-6a83373eb86eec673be2d24fe840a9bce97fcaaa.zip
Adding upstream version 0.9~rc1.upstream/0.9_rc1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'ztest.cc')
-rw-r--r--ztest.cc24
1 files changed, 5 insertions, 19 deletions
diff --git a/ztest.cc b/ztest.cc
index 6a9b910..3672aa8 100644
--- a/ztest.cc
+++ b/ztest.cc
@@ -60,23 +60,16 @@ int ztest_stdin( const int infd,
argv[ztest_args.size()+2] = 0;
execvp( argv[0], (char **)argv );
}
- if( verbosity >= 0 )
- std::fprintf( stderr, "%s: Can't exec `%s': %s.\n",
- util_name, file_type.c_str(), std::strerror( errno ) );
+ show_exec_error( file_type.c_str() );
_exit( 1 );
}
// parent
if( pid < 0 )
- {
- if( verbosity >= 0 )
- std::fprintf( stderr, "%s: Can't fork `%s': %s.\n",
- util_name, file_type.c_str(), std::strerror( errno ) );
- return 1;
- }
+ { show_fork_error( file_type.c_str() ); return 1; }
close( fda[0] );
if( !feed_data( infd, fda[1], magic_data, magic_size ) ) return 1;
if( close( fda[1] ) != 0 )
- { show_error( "Can't close output of data feeder", errno ); return 1; }
+ { show_close_error( "data feeder" ); return 1; }
return wait_for_child( pid, file_type.c_str() );
}
@@ -102,18 +95,11 @@ int ztest_file( const int infd, const std::string & input_filename,
argv[ztest_args.size()+3] = input_filename.c_str();
argv[ztest_args.size()+4] = 0;
execvp( argv[0], (char **)argv );
- if( verbosity >= 0 )
- std::fprintf( stderr, "%s: Can't exec `%s': %s.\n",
- util_name, argv[0], std::strerror( errno ) );
+ show_exec_error( file_type.c_str() );
_exit( 1 );
}
// parent
if( pid < 0 )
- {
- if( verbosity >= 0 )
- std::fprintf( stderr, "%s: Can't fork `%s': %s.\n",
- util_name, file_type.c_str(), std::strerror( errno ) );
- return 1;
- }
+ { show_fork_error( file_type.c_str() ); return 1; }
return wait_for_child( pid, file_type.c_str() );
}