diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-12-12 13:39:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-12-12 13:39:07 +0000 |
commit | 4a9643b557eefa0f3d3eb8847d9d026945eed37e (patch) | |
tree | 9391e726cdc9e5f5ace3f41c52373c52c5aa85f4 /delete.cc | |
parent | Releasing debian version 0.25-2. (diff) | |
download | tarlz-4a9643b557eefa0f3d3eb8847d9d026945eed37e.tar.xz tarlz-4a9643b557eefa0f3d3eb8847d9d026945eed37e.zip |
Merging upstream version 0.26.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'delete.cc')
-rw-r--r-- | delete.cc | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -20,7 +20,7 @@ #include <cctype> #include <cerrno> #include <cstdio> -#include <stdint.h> // for lzlib.h +#include <stdint.h> // for lzlib.h #include <unistd.h> #include <lzlib.h> @@ -44,7 +44,7 @@ int tail_copy( const Arg_parser & parser, const Archive_descriptor & ad, const long long rest = ad.lzip_index.file_size() - istream_pos; if( istream_pos > 0 && rest > 0 && ( !safe_seek( ad.infd, istream_pos ) || - !copy_file( ad.infd, outfd, rest ) ) ) + !copy_file( ad.infd, outfd, ad.namep, rest ) ) ) { show_file_error( ad.namep, "Error during tail copy." ); return retval ? retval : 1; } const long long ostream_pos = lseek( outfd, 0, SEEK_CUR ); @@ -85,6 +85,8 @@ int delete_members( const Cl_options & cl_opts ) { show_error( "Deleting from stdin not implemented yet." ); return 1; } const Archive_descriptor ad( cl_opts.archive_name ); if( ad.infd < 0 ) return 1; + if( ad.name.size() && ad.indexed && ad.lzip_index.multi_empty() ) + { show_file_error( ad.namep, empty_msg ); close( ad.infd ); return 2; } const int outfd = open_outstream( cl_opts.archive_name, false ); if( outfd < 0 ) { close( ad.infd ); return 1; } @@ -177,7 +179,7 @@ int delete_members( const Cl_options & cl_opts ) if( istream_pos == 0 ) { if( !safe_seek( outfd, size ) ) { retval = 1; break; } } else if( !safe_seek( ad.infd, istream_pos ) || - !copy_file( ad.infd, outfd, size ) || + !copy_file( ad.infd, outfd, ad.namep, size ) || !safe_seek( ad.infd, pos ) ) { retval = 1; break; } } istream_pos = pos; |