mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
stop clonepath at base directory. fixes #467
This commit is contained in:
parent
62ae871d51
commit
f48c16d162
14 changed files with 238 additions and 267 deletions
|
|
@ -34,7 +34,6 @@ using std::vector;
|
|||
using namespace mergerfs;
|
||||
|
||||
static
|
||||
inline
|
||||
int
|
||||
_mkdir_core(const string &fullpath,
|
||||
mode_t mode,
|
||||
|
|
@ -48,10 +47,8 @@ _mkdir_core(const string &fullpath,
|
|||
|
||||
static
|
||||
int
|
||||
_mkdir_loop_core(const string &existingpath,
|
||||
const string &createpath,
|
||||
_mkdir_loop_core(const string &createpath,
|
||||
const char *fusepath,
|
||||
const char *fusedirpath,
|
||||
const mode_t mode,
|
||||
const mode_t umask,
|
||||
const int error)
|
||||
|
|
@ -59,14 +56,6 @@ _mkdir_loop_core(const string &existingpath,
|
|||
int rv;
|
||||
string fullpath;
|
||||
|
||||
if(createpath != existingpath)
|
||||
{
|
||||
const ugid::SetRootGuard ugidGuard;
|
||||
rv = fs::clonepath(existingpath,createpath,fusedirpath);
|
||||
if(rv == -1)
|
||||
return errno;
|
||||
}
|
||||
|
||||
fs::path::make(&createpath,fusepath,fullpath);
|
||||
|
||||
rv = _mkdir_core(fullpath,mode,umask);
|
||||
|
|
@ -83,13 +72,19 @@ _mkdir_loop(const string &existingpath,
|
|||
const mode_t mode,
|
||||
const mode_t umask)
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
|
||||
error = -1;
|
||||
for(size_t i = 0, ei = createpaths.size(); i != ei; i++)
|
||||
{
|
||||
error = _mkdir_loop_core(existingpath,*createpaths[i],
|
||||
fusepath,fusedirpath,mode,umask,error);
|
||||
rv = fs::clonepath_as_root(existingpath,*createpaths[i],fusedirpath);
|
||||
if(rv == -1)
|
||||
error = error::calc(rv,error,errno);
|
||||
else
|
||||
error = _mkdir_loop_core(*createpaths[i],
|
||||
fusepath,
|
||||
mode,umask,error);
|
||||
}
|
||||
|
||||
return -error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue