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