diff options
Diffstat (limited to 'reproduce.cc')
-rw-r--r-- | reproduce.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/reproduce.cc b/reproduce.cc index bca229a..5ca91a7 100644 --- a/reproduce.cc +++ b/reproduce.cc @@ -1,5 +1,5 @@ /* Lziprecover - Data recovery tool for the lzip format - Copyright (C) 2009-2023 Antonio Diaz Diaz. + Copyright (C) 2009-2024 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -532,8 +532,9 @@ int reproduce_file( const std::string & input_filename, { show_file_error( filename, lzip_index.error().c_str() ); return lzip_index.retval(); } - output_filename = default_output_filename.empty() ? - insert_fixed( input_filename ) : default_output_filename; + const bool to_file = default_output_filename.size(); + output_filename = + to_file ? default_output_filename : insert_fixed( input_filename ); if( !force && output_file_exists() ) return 1; outfd = -1; int errors = 0; @@ -593,7 +594,7 @@ int reproduce_file( const std::string & input_filename, { if( !safe_seek( infd, 0, filename ) ) return 1; set_signal_handler(); - if( !open_outstream( true, true ) ) return 1; + if( !open_outstream( true, true, false, true, to_file ) ) return 1; if( !copy_file( infd, outfd ) ) // copy whole file cleanup_and_fail( 1 ); } @@ -619,7 +620,7 @@ int reproduce_file( const std::string & input_filename, filename ); return 0; } - if( close_outstream( &in_stats ) != 0 ) return 1; + if( !close_outstream( &in_stats ) ) return 1; if( verbosity >= 0 ) { if( errors > 1 ) |