1
0
Fork 0

Merging upstream version 0.9~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 05:04:40 +01:00
parent 4f4c7c8781
commit 6503461316
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
19 changed files with 126 additions and 131 deletions

20
zcmp.cc
View file

@ -20,7 +20,6 @@
#include <cctype>
#include <cerrno>
#include <climits>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
@ -166,9 +165,8 @@ long long getnum( const char * const ptr, const char ** const tailp = 0,
int open_instream( const std::string & input_filename ) throw()
{
int infd = open( input_filename.c_str(), O_RDONLY | o_binary );
if( infd < 0 && verbosity >= 0 )
std::fprintf( stderr, "%s: Can't open input file `%s': %s.\n",
util_name, input_filename.c_str(), std::strerror( errno ) );
if( infd < 0 )
show_error2( "Can't open input file", input_filename.c_str() );
return infd;
}
@ -293,9 +291,7 @@ int cmp( const long long max_size, const int infd[2],
rd[i] = readblock( infd[i], buffer[i], size );
if( rd[i] != size && errno )
{
if( verbosity >= 0 )
std::fprintf( stderr, "%s: Error reading file `%s': %s.\n",
util_name, filenames[i].c_str(), std::strerror( errno ) );
show_error2( "Error reading file", filenames[i].c_str() );
return 2;
}
}
@ -467,9 +463,7 @@ int main( const int argc, const char * const argv[] )
for( int i = 0; i < 2; ++i )
if( !skip_ignore_initial( ignore_initial[i], infd[i] ) )
{
if( verbosity >= 0 )
std::fprintf( stderr, "%s: Can't skip initial bytes from file `%s': %s.\n",
util_name, filenames[i].c_str(), std::strerror( errno ) );
show_error2( "Can't skip initial bytes from file", filenames[i].c_str() );
return 2;
}
@ -483,12 +477,10 @@ int main( const int argc, const char * const argv[] )
for( int i = 0; i < 2; ++i )
{
if( close( infd[i] ) != 0 )
{ show_error( "Can't close output of data feeder", errno ); retval = 2; }
{ show_close_error( "data feeder" ); retval = 2; }
if( filenames[i] != "-" && close( old_infd[i] ) != 0 )
{
if( verbosity >= 0 )
std::fprintf( stderr, "%s: Can't close input file `%s': %s.\n",
util_name, filenames[i].c_str(), std::strerror( errno ) );
show_error2( "Can't close input file", filenames[i].c_str() );
retval = 2;
}
}