1
0
Fork 0

Merging upstream version 1.12~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 06:02:28 +01:00
parent 411f37263d
commit d5110769e8
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
29 changed files with 1120 additions and 662 deletions

View file

@ -110,7 +110,7 @@ int writeblock( const int fd, const uint8_t * const buf, const int size )
}
// Empty filename means stdin.
// filename == "-" means stdin.
//
bool feed_data( const std::string & filename, const int infd, const int outfd,
const uint8_t * magic_data, const int magic_size )
@ -123,8 +123,8 @@ bool feed_data( const std::string & filename, const int infd, const int outfd,
{
const int size = readblock( infd, buffer, buffer_size );
if( size != buffer_size && errno )
{ const char * const name = filename.empty() ? "-" : filename.c_str();
show_file_error( name, "Read error", errno ); return false; }
{ show_file_error( name_or_stdin( filename.c_str() ), "Read error",
errno ); return false; }
if( size > 0 && writeblock( outfd, buffer, size ) != size )
{ show_error( "Write error", errno ); return false; }
if( size < buffer_size ) break;
@ -183,8 +183,7 @@ bool set_data_feeder( const std::string & filename, int * const infdp,
close( fda2[0] ) != 0 || close( fda2[1] ) != 0 ||
!feed_data( filename, old_infd, fda[1], magic_data, magic_size ) )
_exit( 2 );
if( close( fda[1] ) != 0 )
{ show_close_error(); _exit( 2 ); }
if( close( fda[1] ) != 0 ) { show_close_error(); _exit( 2 ); }
_exit( 0 );
}
if( pid < 0 ) // parent
@ -232,8 +231,7 @@ bool set_data_feeder( const std::string & filename, int * const infdp,
if( close( fda[0] ) != 0 ||
!feed_data( filename, old_infd, fda[1], magic_data, magic_size ) )
_exit( 2 );
if( close( fda[1] ) != 0 )
{ show_close_error(); _exit( 2 ); }
if( close( fda[1] ) != 0 ) { show_close_error(); _exit( 2 ); }
_exit( 0 );
}
if( pid < 0 ) // parent
@ -246,7 +244,7 @@ bool set_data_feeder( const std::string & filename, int * const infdp,
}
// Return format index, or -1 if uncompressed.
// Return format_index, or -1 if uncompressed.
//
int test_format( const int infd, uint8_t magic_data[],
int * const magic_sizep )