1
0
Fork 0

Merging upstream version 1.2~pre3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 05:45:59 +01:00
parent 388270afb8
commit 57a593e0b1
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
32 changed files with 1172 additions and 1035 deletions

View file

@ -36,12 +36,8 @@
#endif
#include "arg_parser.h"
#include "zutils.h"
#include "rc.h"
#if CHAR_BIT != 8
#error "Environments where CHAR_BIT != 8 are not supported."
#endif
#include "zutils.h"
namespace {
@ -50,7 +46,6 @@ std::string fifonames[2]; // names of the two fifos passed to diff
#include "zcmpdiff.cc"
void show_help()
{
std::printf( "Zdiff compares two files (\"-\" means standard input), and if they\n"
@ -177,7 +172,7 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
!feed_data( infd, fda[1], magic_data, magic_size ) )
_exit( 2 );
if( close( fda[1] ) != 0 )
{ show_close_error( "data feeder" ); _exit( 2 ); }
{ show_close_error(); _exit( 2 ); }
_exit( 0 );
}
if( pid < 0 ) // parent
@ -186,12 +181,12 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
const pid_t pid2 = fork();
if( pid2 == 0 ) // child 2 (compressor)
{
const int outfd = open( fifoname.c_str(), O_WRONLY | o_binary );
const int outfd = open( fifoname.c_str(), O_WRONLY | O_BINARY );
if( outfd < 0 )
{
if( verbosity >= 0 )
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n",
util_name, fifoname.c_str(), std::strerror( errno ) );
program_name, fifoname.c_str(), std::strerror( errno ) );
_exit( 2 );
}
if( dup2( fda[0], STDIN_FILENO ) >= 0 &&
@ -225,18 +220,18 @@ bool set_data_feeder( const std::string & fifoname, const int infd,
const pid_t pid = fork();
if( pid == 0 ) // child (feeder)
{
const int outfd = open( fifoname.c_str(), O_WRONLY | o_binary );
const int outfd = open( fifoname.c_str(), O_WRONLY | O_BINARY );
if( outfd < 0 )
{
if( verbosity >= 0 )
std::fprintf( stderr, "%s: Can't open FIFO '%s' for writing: %s.\n",
util_name, fifoname.c_str(), std::strerror( errno ) );
program_name, fifoname.c_str(), std::strerror( errno ) );
_exit( 2 );
}
if( !feed_data( infd, outfd, magic_data, magic_size ) )
_exit( 2 );
if( close( outfd ) != 0 )
{ show_close_error( "data feeder" ); _exit( 2 ); }
{ show_close_error(); _exit( 2 ); }
_exit( 0 );
}
if( pid < 0 ) // parent
@ -272,7 +267,7 @@ int main( const int argc, const char * const argv[] )
std::vector< const char * > diff_args; // args to diff, maybe empty
int format_types[2] = { -1, -1 };
invocation_name = argv[0];
util_name = "zdiff";
program_name = "zdiff";
const Arg_parser::Option options[] =
{