summaryrefslogtreecommitdiffstats
path: root/decode.cc
diff options
context:
space:
mode:
Diffstat (limited to 'decode.cc')
-rw-r--r--decode.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/decode.cc b/decode.cc
index bcac4c8..f2ffa52 100644
--- a/decode.cc
+++ b/decode.cc
@@ -22,15 +22,15 @@
#include <cerrno>
#include <cstdio>
#include <fcntl.h>
-#include <stdint.h> // for lzlib.h
+#include <stdint.h> // for lzlib.h
#include <unistd.h>
#include <utime.h>
#include <sys/stat.h>
#if !defined __FreeBSD__ && !defined __OpenBSD__ && !defined __NetBSD__ && \
!defined __DragonFly__ && !defined __APPLE__ && !defined __OS2__
-#include <sys/sysmacros.h> // for major, minor, makedev
+#include <sys/sysmacros.h> // for major, minor, makedev
#else
-#include <sys/types.h> // for major, minor, makedev
+#include <sys/types.h> // for major, minor, makedev
#endif
#include <lzlib.h>
@@ -190,7 +190,7 @@ int extract_member( const Cl_options & cl_opts, Archive_reader & ar,
return skip_member( ar, extended, typeflag );
}
- const bool islink = ( typeflag == tf_link || typeflag == tf_symlink );
+ const bool islink = typeflag == tf_link || typeflag == tf_symlink;
errno = 0;
if( !islink &&
( !uid_gid_in_range( extended.get_uid(), extended.get_gid() ) ||
@@ -229,7 +229,7 @@ int extract_member( const Cl_options & cl_opts, Archive_reader & ar,
}
const int wsize = ( rest >= bufsize ) ? bufsize : rest;
if( outfd >= 0 && writeblock( outfd, buf, wsize ) != wsize )
- { show_file_error( filename, werr_msg, errno ); return 1; }
+ { show_file_error( filename, wr_err_msg, errno ); return 1; }
rest -= wsize;
}
}
@@ -347,7 +347,7 @@ bool compare_file_type( std::string & estr, std::string & ostr,
{
char * const buf = new char[st.st_size+1];
long len = readlink( filename, buf, st.st_size );
- bool e = ( len != st.st_size );
+ bool e = len != st.st_size;
if( !e )
{
while( len > 1 && buf[len-1] == '/' ) --len; // trailing '/'
@@ -412,6 +412,8 @@ int decode( const Cl_options & cl_opts )
// open archive before changing working directory
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 bool c_present = option_C_present( cl_opts.parser ) &&
cl_opts.program_mode != m_list;