mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-19 22:46:34 -05:00
return clonepath errors
currently the error is ignored and it was expected the primary call would fail. problem is it returns confusing errors as a result. (eg ENOENT vs EPERM)
This commit is contained in:
parent
05d81dbc23
commit
35075bb0cd
6 changed files with 53 additions and 34 deletions
|
|
@ -57,6 +57,27 @@ _remove(const vector<string> &toremove)
|
|||
::remove(toremove[i].c_str());
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_rename(const std::string &oldbasepath,
|
||||
const std::string &oldfullpath,
|
||||
const std::string &newbasepath,
|
||||
const std::string &newfusedirpath,
|
||||
const std::string &newfullpath)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if(oldbasepath != newbasepath)
|
||||
{
|
||||
const ugid::SetRootGuard guard;
|
||||
rv = fs::clonepath(newbasepath,oldbasepath,newfusedirpath.c_str());
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fs::rename(oldfullpath,newfullpath);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_rename_create_path_core(const vector<const string*> &oldbasepaths,
|
||||
|
|
@ -78,15 +99,10 @@ _rename_create_path_core(const vector<const string*> &oldbasepaths,
|
|||
ismember = member(oldbasepaths,oldbasepath);
|
||||
if(ismember)
|
||||
{
|
||||
if(oldbasepath != newbasepath)
|
||||
{
|
||||
const ugid::SetRootGuard ugidGuard;
|
||||
fs::clonepath(newbasepath,oldbasepath,newfusedirpath.c_str());
|
||||
}
|
||||
|
||||
fs::path::make(&oldbasepath,oldfusepath,oldfullpath);
|
||||
|
||||
rv = fs::rename(oldfullpath,newfullpath);
|
||||
rv = _rename(oldbasepath,oldfullpath,
|
||||
newbasepath,newfusedirpath,newfullpath);
|
||||
error = calc_error(rv,error,errno);
|
||||
if(RENAME_FAILED(rv))
|
||||
tounlink.push_back(oldfullpath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue