diff options
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; |