summaryrefslogtreecommitdiffstats
path: root/delete_lz.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-13 09:09:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-13 09:10:01 +0000
commit3edd69686171314709676dafc694fd6ba2533def (patch)
tree7e2b73bcedbc50eefbcb380560454577a5c796aa /delete_lz.cc
parentReleasing debian version 0.15-3. (diff)
downloadtarlz-3edd69686171314709676dafc694fd6ba2533def.tar.xz
tarlz-3edd69686171314709676dafc694fd6ba2533def.zip
Merging upstream version 0.16.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'delete_lz.cc')
-rw-r--r--delete_lz.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/delete_lz.cc b/delete_lz.cc
index 11c3a14..6888520 100644
--- a/delete_lz.cc
+++ b/delete_lz.cc
@@ -51,7 +51,7 @@ int delete_members_lz( const char * const archive_namep,
long long istream_pos = 0; // source of next data move
const long long cdata_size = lzip_index.cdata_size();
- int retval = 0;
+ int retval = 0, retval2 = 0;
for( long i = 0; i < lzip_index.members(); ++i )
{
const long long mdata_pos = lzip_index.dblock( i ).pos();
@@ -142,16 +142,16 @@ int delete_members_lz( const char * const archive_namep,
if( member_begin != mdata_pos || data_pos != mdata_end )
{ show_file_error( extended.path().c_str(),
"Can't delete: not individually compressed." );
- retval = 2; extended.reset(); continue; }
+ retval2 = 2; extended.reset(); continue; }
if( !show_member_name( extended, header, 1, rbuf ) )
{ retval = 1; goto done; }
const long long size = member_pos - istream_pos;
if( size > 0 ) // move pending data each time a member is deleted
{
if( istream_pos == 0 )
- { if( !safe_seek( outfd, size ) ) { retval = 1; break; } }
+ { if( !safe_seek( outfd, size ) ) { retval = 1; goto done; } }
else if( !safe_seek( infd, istream_pos ) ||
- !copy_file( infd, outfd, size ) ) { retval = 1; break; }
+ !copy_file( infd, outfd, size ) ) { retval = 1; goto done; }
}
istream_pos = member_end;
}
@@ -159,6 +159,7 @@ int delete_members_lz( const char * const archive_namep,
}
}
done:
+ if( retval < retval2 ) retval = retval2;
if( LZ_decompress_close( decoder ) < 0 && !retval )
{ show_error( "LZ_decompress_close failed." ); retval = 1; }
// tail copy keeps trailing data