diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-08 15:52:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-08 15:52:09 +0000 |
commit | 4568b11461f80bbc5fa0fb2c522205683ea14ec7 (patch) | |
tree | 58834b3aa970b99bc0a1b0fcb9ae5510ca149cb1 /zutils.cc | |
parent | Adding upstream version 1.12~pre2. (diff) | |
download | zutils-4568b11461f80bbc5fa0fb2c522205683ea14ec7.tar.xz zutils-4568b11461f80bbc5fa0fb2c522205683ea14ec7.zip |
Adding upstream version 1.12~rc1.upstream/1.12_rc1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | zutils.cc | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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 ) |