mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-25 09:26:25 -05: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
|
|
@ -36,24 +36,14 @@ using namespace mergerfs;
|
|||
|
||||
static
|
||||
int
|
||||
_symlink_loop_core(const string &existingpath,
|
||||
const string &newbasepath,
|
||||
_symlink_loop_core(const string &newbasepath,
|
||||
const char *oldpath,
|
||||
const char *newpath,
|
||||
const char *newdirpath,
|
||||
const int error)
|
||||
{
|
||||
int rv;
|
||||
string fullnewpath;
|
||||
|
||||
if(newbasepath != existingpath)
|
||||
{
|
||||
const ugid::SetRootGuard ugidGuard;
|
||||
rv = fs::clonepath(existingpath,newbasepath,newdirpath);
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
fs::path::make(&newbasepath,newpath,fullnewpath);
|
||||
|
||||
rv = fs::symlink(oldpath,fullnewpath);
|
||||
|
|
@ -69,14 +59,20 @@ _symlink_loop(const string &existingpath,
|
|||
const char *newpath,
|
||||
const char *newdirpath)
|
||||
{
|
||||
int rv;
|
||||
int error;
|
||||
|
||||
error = -1;
|
||||
for(size_t i = 0, ei = newbasepaths.size(); i != ei; i++)
|
||||
{
|
||||
error = _symlink_loop_core(existingpath,*newbasepaths[i],
|
||||
oldpath,newpath,newdirpath,
|
||||
error);
|
||||
rv = fs::clonepath_as_root(existingpath,*newbasepaths[i],newdirpath);
|
||||
if(rv == -1)
|
||||
error = error::calc(rv,error,errno);
|
||||
else
|
||||
error = _symlink_loop_core(*newbasepaths[i],
|
||||
oldpath,
|
||||
newpath,
|
||||
error);
|
||||
}
|
||||
|
||||
return -error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue