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
|
|
@ -26,6 +26,7 @@
|
|||
#include "fs_clonepath.hpp"
|
||||
#include "fs_path.hpp"
|
||||
#include "fs_xattr.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
using std::string;
|
||||
|
||||
|
|
@ -59,6 +60,9 @@ namespace fs
|
|||
string frompath;
|
||||
string dirname;
|
||||
|
||||
if((relative == NULL) || (relative[0] == '\0'))
|
||||
return 0;
|
||||
|
||||
dirname = relative;
|
||||
fs::path::dirname(dirname);
|
||||
if(!dirname.empty())
|
||||
|
|
@ -114,4 +118,29 @@ namespace fs
|
|||
{
|
||||
return fs::clonepath(from,to,relative.c_str());
|
||||
}
|
||||
|
||||
int
|
||||
clonepath_as_root(const string &from,
|
||||
const string &to,
|
||||
const char *relative)
|
||||
{
|
||||
if((relative == NULL) || (relative[0] == '\0'))
|
||||
return 0;
|
||||
if(from == to)
|
||||
return 0;
|
||||
|
||||
{
|
||||
const ugid::SetRootGuard ugidGuard;
|
||||
|
||||
return fs::clonepath(from,to,relative);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
clonepath_as_root(const std::string &from,
|
||||
const std::string &to,
|
||||
const std::string &relative)
|
||||
{
|
||||
return fs::clonepath_as_root(from,to,relative.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue