mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-19 22:46:34 -05:00
rework rename
Return EXDEV if directories of tragets differ. If the old and new path exist in the same directory first rename each old found by the policy and then unlink/rmdir any new on a drive which didn't rename. The unlink/rmdir will occur only if there were no rename errors. Any failures of unlink/rmdir are ignored. The last rename error is returned.
This commit is contained in:
parent
6b5b7c38f4
commit
1f1e481075
4 changed files with 68 additions and 38 deletions
|
|
@ -133,7 +133,7 @@ namespace fs
|
|||
string path;
|
||||
struct stat st;
|
||||
|
||||
path = fs::path::make(paths[i],fusepath);
|
||||
fs::path::make(paths[i],fusepath,path);
|
||||
|
||||
rv = ::lstat(path.c_str(),&st);
|
||||
if(rv == 0)
|
||||
|
|
@ -155,7 +155,7 @@ namespace fs
|
|||
string fullpath;
|
||||
struct stat st;
|
||||
|
||||
fullpath = fs::path::make(srcmounts[i],fusepath);
|
||||
fs::path::make(srcmounts[i],fusepath,fullpath);
|
||||
|
||||
rv = ::lstat(fullpath.c_str(),&st);
|
||||
if(rv == 0)
|
||||
|
|
@ -456,14 +456,14 @@ namespace fs
|
|||
return -1;
|
||||
}
|
||||
|
||||
frompath = fs::path::make(fromsrc,relative);
|
||||
fs::path::make(fromsrc,relative,frompath);
|
||||
rv = ::stat(frompath.c_str(),&st);
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
else if(!S_ISDIR(st.st_mode))
|
||||
return (errno = ENOTDIR,-1);
|
||||
|
||||
topath = fs::path::make(tosrc,relative);
|
||||
fs::path::make(tosrc,relative,topath);
|
||||
rv = ::mkdir(topath.c_str(),st.st_mode);
|
||||
if(rv == -1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue