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
|
@ -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
|
||||
|
@ -227,24 +227,23 @@ bool check_skip_filename( const Cl_options & cl_opts,
|
|||
}
|
||||
|
||||
|
||||
bool make_path( const std::string & name )
|
||||
bool make_dirs( const std::string & name )
|
||||
{
|
||||
const mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
|
||||
unsigned end = name.size(); // first slash before last component
|
||||
int i = name.size();
|
||||
while( i > 0 && name[i-1] == '/' ) --i; // remove trailing slashes
|
||||
while( i > 0 && name[i-1] != '/' ) --i; // remove last component
|
||||
while( i > 0 && name[i-1] == '/' ) --i; // remove more slashes
|
||||
const int dirsize = i; // first slash before last component
|
||||
|
||||
while( end > 0 && name[end-1] == '/' ) --end; // remove trailing slashes
|
||||
while( end > 0 && name[end-1] != '/' ) --end; // remove last component
|
||||
while( end > 0 && name[end-1] == '/' ) --end; // remove more slashes
|
||||
|
||||
unsigned index = 0;
|
||||
while( index < end )
|
||||
for( i = 0; i < dirsize; ) // if dirsize == 0, dirname is '/' or empty
|
||||
{
|
||||
while( index < end && name[index] == '/' ) ++index;
|
||||
unsigned first = index;
|
||||
while( index < end && name[index] != '/' ) ++index;
|
||||
if( first < index )
|
||||
while( i < dirsize && name[i] == '/' ) ++i;
|
||||
const int first = i;
|
||||
while( i < dirsize && name[i] != '/' ) ++i;
|
||||
if( first < i )
|
||||
{
|
||||
const std::string partial( name, 0, index );
|
||||
const std::string partial( name, 0, i );
|
||||
const mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
|
||||
struct stat st;
|
||||
if( lstat( partial.c_str(), &st ) == 0 )
|
||||
{ if( !S_ISDIR( st.st_mode ) ) { errno = ENOTDIR; return false; } }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue