summaryrefslogtreecommitdiffstats
path: root/zutils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'zutils.cc')
-rw-r--r--zutils.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/zutils.cc b/zutils.cc
index 1daa283..01a8406 100644
--- a/zutils.cc
+++ b/zutils.cc
@@ -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 )