mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-02 11:35:00 +08:00
msp policies stopped before root path
This commit is contained in:
parent
8a335d8a6e
commit
44a98910ba
|
@ -40,32 +40,25 @@ namespace fs
|
||||||
string
|
string
|
||||||
dirname(const string &path_)
|
dirname(const string &path_)
|
||||||
{
|
{
|
||||||
string rv;
|
std::size_t i;
|
||||||
string::reverse_iterator i;
|
|
||||||
string::reverse_iterator ei;
|
|
||||||
|
|
||||||
rv = path_;
|
i = path_.size() - 1;
|
||||||
|
while((i > 0) && (path_[i] == '/'))
|
||||||
|
i--;
|
||||||
|
|
||||||
i = rv.rbegin();
|
while((i > 0) && (path_[i] != '/'))
|
||||||
ei = rv.rend();
|
i--;
|
||||||
while(*i == '/' && i != ei)
|
|
||||||
i++;
|
|
||||||
|
|
||||||
while(*i != '/' && i != ei)
|
while((i > 0) && (path_[i] == '/'))
|
||||||
i++;
|
i--;
|
||||||
|
|
||||||
while(*i == '/' && i != ei)
|
return path_.substr(0,i+1);
|
||||||
i++;
|
|
||||||
|
|
||||||
rv.erase(i.base(),rv.end());
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
basename(const string &path)
|
basename(const string &path_)
|
||||||
{
|
{
|
||||||
return path.substr(path.find_last_of('/')+1);
|
return path_.substr(path_.find_last_of('/')+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,15 +85,15 @@ namespace msplfs
|
||||||
|
|
||||||
error = ENOENT;
|
error = ENOENT;
|
||||||
fusepath = fusepath_;
|
fusepath = fusepath_;
|
||||||
do
|
for(;;)
|
||||||
{
|
{
|
||||||
basepath = msplfs::create_1(branches_,fusepath,&error);
|
basepath = msplfs::create_1(branches_,fusepath,&error);
|
||||||
if(basepath)
|
if(basepath)
|
||||||
break;
|
break;
|
||||||
|
if(fusepath == "/")
|
||||||
|
break;
|
||||||
fusepath = fs::path::dirname(fusepath);
|
fusepath = fs::path::dirname(fusepath);
|
||||||
}
|
}
|
||||||
while(!fusepath.empty());
|
|
||||||
|
|
||||||
if(basepath == NULL)
|
if(basepath == NULL)
|
||||||
return (errno=error,-1);
|
return (errno=error,-1);
|
||||||
|
|
|
@ -85,15 +85,15 @@ namespace msplus
|
||||||
|
|
||||||
error = ENOENT;
|
error = ENOENT;
|
||||||
fusepath = fusepath_;
|
fusepath = fusepath_;
|
||||||
do
|
for(;;)
|
||||||
{
|
{
|
||||||
basepath = msplus::create_1(branches_,fusepath,&error);
|
basepath = msplus::create_1(branches_,fusepath,&error);
|
||||||
if(basepath)
|
if(basepath)
|
||||||
break;
|
break;
|
||||||
|
if(fusepath == "/")
|
||||||
|
break;
|
||||||
fusepath = fs::path::dirname(fusepath);
|
fusepath = fs::path::dirname(fusepath);
|
||||||
}
|
}
|
||||||
while(!fusepath.empty());
|
|
||||||
|
|
||||||
if(basepath == NULL)
|
if(basepath == NULL)
|
||||||
return (errno=error,-1);
|
return (errno=error,-1);
|
||||||
|
|
|
@ -85,15 +85,15 @@ namespace mspmfs
|
||||||
|
|
||||||
error = ENOENT;
|
error = ENOENT;
|
||||||
fusepath = fusepath_;
|
fusepath = fusepath_;
|
||||||
do
|
for(;;)
|
||||||
{
|
{
|
||||||
basepath = mspmfs::create_1(branches_,fusepath,&error);
|
basepath = mspmfs::create_1(branches_,fusepath,&error);
|
||||||
if(basepath)
|
if(basepath)
|
||||||
break;
|
break;
|
||||||
|
if(fusepath == "/")
|
||||||
|
break;
|
||||||
fusepath = fs::path::dirname(fusepath);
|
fusepath = fs::path::dirname(fusepath);
|
||||||
}
|
}
|
||||||
while(!fusepath.empty());
|
|
||||||
|
|
||||||
if(basepath == NULL)
|
if(basepath == NULL)
|
||||||
return (errno=error,-1);
|
return (errno=error,-1);
|
||||||
|
|
|
@ -108,15 +108,15 @@ namespace msppfrd
|
||||||
string fusepath;
|
string fusepath;
|
||||||
|
|
||||||
fusepath = fusepath_;
|
fusepath = fusepath_;
|
||||||
do
|
for(;;)
|
||||||
{
|
{
|
||||||
error = msppfrd::create_1(branches_,fusepath,branchinfo_,sum_);
|
error = msppfrd::create_1(branches_,fusepath,branchinfo_,sum_);
|
||||||
if(branchinfo_->size())
|
if(branchinfo_->size())
|
||||||
return error;
|
break;
|
||||||
|
if(fusepath == "/")
|
||||||
|
break;
|
||||||
fusepath = fs::path::dirname(fusepath);
|
fusepath = fs::path::dirname(fusepath);
|
||||||
}
|
}
|
||||||
while(!fusepath.empty());
|
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user