mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-23 06:29:57 +08:00
tweak movefile behavior
This commit is contained in:
parent
d9be1c4841
commit
f15437c713
@ -36,6 +36,15 @@ using std::vector;
|
|||||||
|
|
||||||
namespace fs
|
namespace fs
|
||||||
{
|
{
|
||||||
|
int
|
||||||
|
movefile(const vector<string> &basepaths,
|
||||||
|
const string &fusepath,
|
||||||
|
const size_t additional_size,
|
||||||
|
int &origfd)
|
||||||
|
{
|
||||||
|
return fs::movefile(basepaths,fusepath.c_str(),additional_size,origfd);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
movefile(const vector<string> &basepaths,
|
movefile(const vector<string> &basepaths,
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
@ -95,19 +104,12 @@ namespace fs
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = fs::unlink(fdin_path);
|
// should we care if it fails?
|
||||||
if(rv == -1)
|
fs::unlink(fdin_path);
|
||||||
{
|
|
||||||
|
std::swap(origfd,fdout);
|
||||||
fs::close(fdin);
|
fs::close(fdin);
|
||||||
fs::close(fdout);
|
fs::close(fdout);
|
||||||
fs::unlink(fdout_path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::close(fdin);
|
|
||||||
fs::close(origfd);
|
|
||||||
|
|
||||||
origfd = fdout;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,13 @@
|
|||||||
namespace fs
|
namespace fs
|
||||||
{
|
{
|
||||||
int
|
int
|
||||||
movefile(const vector<string> &basepaths,
|
movefile(const std::vector<std::string> &basepaths,
|
||||||
|
const std::string &fusepath,
|
||||||
|
const size_t additional_size,
|
||||||
|
int &origfd);
|
||||||
|
|
||||||
|
int
|
||||||
|
movefile(const std::vector<std::string> &basepaths,
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
const size_t additional_size,
|
const size_t additional_size,
|
||||||
int &origfd);
|
int &origfd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user