mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-06-22 21:51:55 +08:00
fix rename'ing to local device
This commit is contained in:
10
src/fs.cpp
10
src/fs.cpp
@ -136,12 +136,12 @@ namespace fs
|
|||||||
|
|
||||||
string
|
string
|
||||||
make_path(const string base,
|
make_path(const string base,
|
||||||
const string fusepath)
|
const string suffix)
|
||||||
{
|
{
|
||||||
if(*base.rbegin() == '/' ||
|
if(suffix[0] == '/' ||
|
||||||
*fusepath.rbegin() == '/')
|
*base.rbegin() == '/')
|
||||||
return base + fusepath;
|
return base + suffix;
|
||||||
return base + '/' + fusepath;
|
return base + '/' + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -57,6 +57,8 @@ _rename(const fs::SearchFunc searchFunc,
|
|||||||
pathto = fs::make_path(pathfrom[0].base,to);
|
pathto = fs::make_path(pathfrom[0].base,to);
|
||||||
|
|
||||||
rv = ::rename(pathfrom[0].full.c_str(),pathto.c_str());
|
rv = ::rename(pathfrom[0].full.c_str(),pathto.c_str());
|
||||||
|
if(rv == -1 && errno == ENOENT)
|
||||||
|
return -EXDEV;
|
||||||
|
|
||||||
return ((rv == -1) ? -errno : 0);
|
return ((rv == -1) ? -errno : 0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user