|
@ -57,6 +57,27 @@ _remove(const vector<string> &toremove) |
|
|
::remove(toremove[i].c_str()); |
|
|
::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 |
|
|
static |
|
|
void |
|
|
void |
|
|
_rename_create_path_core(const vector<const string*> &oldbasepaths, |
|
|
_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); |
|
|
ismember = member(oldbasepaths,oldbasepath); |
|
|
if(ismember) |
|
|
if(ismember) |
|
|
{ |
|
|
{ |
|
|
if(oldbasepath != newbasepath) |
|
|
|
|
|
{ |
|
|
|
|
|
const ugid::SetRootGuard ugidGuard; |
|
|
|
|
|
fs::clonepath(newbasepath,oldbasepath,newfusedirpath.c_str()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fs::path::make(&oldbasepath,oldfusepath,oldfullpath); |
|
|
fs::path::make(&oldbasepath,oldfusepath,oldfullpath); |
|
|
|
|
|
|
|
|
rv = fs::rename(oldfullpath,newfullpath); |
|
|
|
|
|
|
|
|
rv = _rename(oldbasepath,oldfullpath, |
|
|
|
|
|
newbasepath,newfusedirpath,newfullpath); |
|
|
error = calc_error(rv,error,errno); |
|
|
error = calc_error(rv,error,errno); |
|
|
if(RENAME_FAILED(rv)) |
|
|
if(RENAME_FAILED(rv)) |
|
|
tounlink.push_back(oldfullpath); |
|
|
tounlink.push_back(oldfullpath); |
|
|