Browse Source

msp policies stopped before root path

pull/854/head
Antonio SJ Musumeci 4 years ago
parent
commit
44a98910ba
  1. 29
      src/fs_path.cpp
  2. 6
      src/policy_msplfs.cpp
  3. 6
      src/policy_msplus.cpp
  4. 6
      src/policy_mspmfs.cpp
  5. 8
      src/policy_msppfrd.cpp

29
src/fs_path.cpp

@ -40,32 +40,25 @@ namespace fs
string string
dirname(const string &path_) dirname(const string &path_)
{ {
string rv;
string::reverse_iterator i;
string::reverse_iterator ei;
std::size_t i;
rv = path_;
i = path_.size() - 1;
while((i > 0) && (path_[i] == '/'))
i--;
i = rv.rbegin();
ei = rv.rend();
while(*i == '/' && i != ei)
i++;
while((i > 0) && (path_[i] != '/'))
i--;
while(*i != '/' && i != ei)
i++;
while((i > 0) && (path_[i] == '/'))
i--;
while(*i == '/' && i != ei)
i++;
rv.erase(i.base(),rv.end());
return rv;
return path_.substr(0,i+1);
} }
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);
} }
} }
} }

6
src/policy_msplfs.cpp

@ -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);

6
src/policy_msplus.cpp

@ -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);

6
src/policy_mspmfs.cpp

@ -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);

8
src/policy_msppfrd.cpp

@ -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…
Cancel
Save