summaryrefslogtreecommitdiffstats
path: root/delete_lz.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-13 09:09:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-13 09:09:47 +0000
commit4df170936f7f58b339410b3d112ecf6b112319ab (patch)
tree3342e916fd60a5ccb8e50461b52d824930b072dd /delete_lz.cc
parentAdding upstream version 0.15. (diff)
downloadtarlz-4df170936f7f58b339410b3d112ecf6b112319ab.tar.xz
tarlz-4df170936f7f58b339410b3d112ecf6b112319ab.zip
Adding upstream version 0.16.upstream/0.16
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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