Adding upstream version 0.25.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
4f5d0de2b2
commit
8853aa3bf2
33 changed files with 317 additions and 280 deletions
19
decode.cc
19
decode.cc
|
@ -1,5 +1,5 @@
|
|||
/* Tarlz - Archiver with multimember lzip compression
|
||||
Copyright (C) 2013-2023 Antonio Diaz Diaz.
|
||||
Copyright (C) 2013-2024 Antonio Diaz Diaz.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -29,6 +29,8 @@
|
|||
#if !defined __FreeBSD__ && !defined __OpenBSD__ && !defined __NetBSD__ && \
|
||||
!defined __DragonFly__ && !defined __APPLE__ && !defined __OS2__
|
||||
#include <sys/sysmacros.h> // for major, minor, makedev
|
||||
#else
|
||||
#include <sys/types.h> // for major, minor, makedev
|
||||
#endif
|
||||
#include <lzlib.h>
|
||||
|
||||
|
@ -38,6 +40,9 @@
|
|||
#include "archive_reader.h"
|
||||
#include "decode.h"
|
||||
|
||||
#ifndef O_DIRECTORY
|
||||
#define O_DIRECTORY 0
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -124,7 +129,7 @@ int extract_member( const Cl_options & cl_opts, Archive_reader & ar,
|
|||
if( !show_member_name( extended, header, 1, grbuf ) ) return 1;
|
||||
// remove file (or empty dir) before extraction to prevent following links
|
||||
std::remove( filename );
|
||||
if( !make_path( filename ) )
|
||||
if( !make_dirs( filename ) )
|
||||
{
|
||||
show_file_error( filename, intdir_msg, errno );
|
||||
set_error_status( 1 );
|
||||
|
@ -192,7 +197,7 @@ int extract_member( const Cl_options & cl_opts, Archive_reader & ar,
|
|||
chown( filename, extended.get_uid(), extended.get_gid() ) != 0 ) )
|
||||
{
|
||||
if( outfd >= 0 ) mode &= ~( S_ISUID | S_ISGID | S_ISVTX );
|
||||
// chown will in many cases return with EPERM, which can be safely ignored.
|
||||
// chown in many cases returns with EPERM, which can be safely ignored.
|
||||
if( errno != EPERM && errno != EINVAL )
|
||||
{ show_file_error( filename, chown_msg, errno ); set_error_status( 1 ); }
|
||||
}
|
||||
|
@ -286,7 +291,7 @@ bool compare_file_type( std::string & estr, std::string & ostr,
|
|||
struct stat st;
|
||||
bool diff = false, size_differs = false, type_differs = true;
|
||||
if( hstat( filename, &st, cl_opts.dereference ) != 0 )
|
||||
format_file_error( estr, filename, "warning: Can't stat", errno );
|
||||
format_file_error( estr, filename, "warning: can't stat", errno );
|
||||
else if( ( typeflag == tf_regular || typeflag == tf_hiperf ) &&
|
||||
!S_ISREG( st.st_mode ) )
|
||||
format_file_diff( ostr, filename, "Is not a regular file" );
|
||||
|
@ -303,14 +308,14 @@ bool compare_file_type( std::string & estr, std::string & ostr,
|
|||
else
|
||||
{
|
||||
type_differs = false;
|
||||
if( typeflag != tf_symlink )
|
||||
if( typeflag != tf_symlink && !cl_opts.ignore_metadata )
|
||||
{
|
||||
const mode_t mode = parse_octal( header + mode_o, mode_l ); // 12 bits
|
||||
if( mode != ( st.st_mode & ( S_ISUID | S_ISGID | S_ISVTX |
|
||||
S_IRWXU | S_IRWXG | S_IRWXO ) ) )
|
||||
{ format_file_diff( ostr, filename, "Mode differs" ); diff = true; }
|
||||
}
|
||||
if( !cl_opts.ignore_ids )
|
||||
if( !cl_opts.ignore_ids && !cl_opts.ignore_metadata )
|
||||
{
|
||||
if( extended.get_uid() != (long long)st.st_uid )
|
||||
{ format_file_diff( ostr, filename, "Uid differs" ); diff = true; }
|
||||
|
@ -319,7 +324,7 @@ bool compare_file_type( std::string & estr, std::string & ostr,
|
|||
}
|
||||
if( typeflag != tf_symlink )
|
||||
{
|
||||
if( typeflag != tf_directory &&
|
||||
if( typeflag != tf_directory && !cl_opts.ignore_metadata &&
|
||||
extended.mtime().sec() != (long long)st.st_mtime )
|
||||
{
|
||||
if( (time_t)extended.mtime().sec() == st.st_mtime )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue