summaryrefslogtreecommitdiffstats
path: root/split.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-24 04:36:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-24 04:36:49 +0000
commit3f61ac8e91689973737f281b0657ae16216b1960 (patch)
treef2334e5cf62fa1e169053046c68b97c321227952 /split.cc
parentReleasing debian version 1.25~pre1-1. (diff)
downloadlziprecover-3f61ac8e91689973737f281b0657ae16216b1960.tar.xz
lziprecover-3f61ac8e91689973737f281b0657ae16216b1960.zip
Merging upstream version 1.25~rc1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'split.cc')
-rw-r--r--split.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/split.cc b/split.cc
index 48d7915..d95908e 100644
--- a/split.cc
+++ b/split.cc
@@ -88,14 +88,14 @@ int split_file( const std::string & input_filename,
long long mpos = b.pos();
long long msize = b.size();
long long failure_pos = 0;
- if( !safe_seek( infd, mpos, filename ) ) return 1;
+ if( !safe_seek( infd, mpos, input_filename ) ) return 1;
if( test_member_from_file( infd, msize, &failure_pos ) == 1 )
{ // corrupt or fake trailer
while( true )
{
mpos += failure_pos; msize -= failure_pos;
if( msize < min_member_size ) break; // trailing data
- if( !safe_seek( infd, mpos, filename ) ) return 1;
+ if( !safe_seek( infd, mpos, input_filename ) ) return 1;
if( test_member_from_file( infd, msize, &failure_pos ) != 1 ) break;
}
lzip_index = Lzip_index( infd, cl_opts, true, true, mpos );
@@ -106,7 +106,7 @@ int split_file( const std::string & input_filename,
}
}
- if( !safe_seek( infd, 0, filename ) ) return 1;
+ if( !safe_seek( infd, 0, input_filename ) ) return 1;
int max_digits = 1;
for( long i = lzip_index.blocks( true ); i >= 10; i /= 10 ) ++max_digits;
bool to_file = // if true, create intermediate dirs
@@ -120,12 +120,13 @@ int split_file( const std::string & input_filename,
if( mb.pos() > stream_pos ) // gap
{
if( !open_outstream( force, true, false, false, to_file ) ) return 1;
- if( !copy_file( infd, outfd, mb.pos() - stream_pos ) ||
+ if( !copy_file( infd, outfd, input_filename, output_filename,
+ mb.pos() - stream_pos ) ||
!close_outstream( &in_stats ) ) cleanup_and_fail( 1 );
next_filename( max_digits ); to_file = false;
}
if( !open_outstream( force, true, false, false, to_file ) ) return 1; // member
- if( !copy_file( infd, outfd, mb.size() ) ||
+ if( !copy_file( infd, outfd, input_filename, output_filename, mb.size() ) ||
!close_outstream( &in_stats ) ) cleanup_and_fail( 1 );
next_filename( max_digits ); to_file = false;
stream_pos = mb.end();
@@ -133,7 +134,8 @@ int split_file( const std::string & input_filename,
if( lzip_index.file_size() > stream_pos ) // trailing data
{
if( !open_outstream( force, true, false, false, to_file ) ) return 1;
- if( !copy_file( infd, outfd, lzip_index.file_size() - stream_pos ) ||
+ if( !copy_file( infd, outfd, input_filename, output_filename,
+ lzip_index.file_size() - stream_pos ) ||
!close_outstream( &in_stats ) ) cleanup_and_fail( 1 );
next_filename( max_digits ); to_file = false;
}