mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-21 07:26:28 -05:00
all action functions return success should at least one succeed. closes #189
This commit is contained in:
parent
f905116c3d
commit
4c77ac4d24
15 changed files with 321 additions and 286 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include "config.hpp"
|
||||
#include "fs_clonepath.hpp"
|
||||
#include "fs_path.hpp"
|
||||
#include "rv.hpp"
|
||||
#include "rwlock.hpp"
|
||||
#include "ugid.hpp"
|
||||
|
||||
|
|
@ -51,23 +52,6 @@ member(const vector<string> &haystack,
|
|||
return (std::find(haystack.begin(),haystack.end(),needle) != haystack.end());
|
||||
}
|
||||
|
||||
// a single success trumps any failure
|
||||
static
|
||||
int
|
||||
_process_rv(const int rv,
|
||||
const int preverror,
|
||||
const int error)
|
||||
{
|
||||
if(rv == -1)
|
||||
{
|
||||
if(preverror == 0)
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_remove(const vector<string> &toremove)
|
||||
|
|
@ -106,7 +90,7 @@ _rename_create_path_one(const vector<string> &oldbasepaths,
|
|||
fs::path::make(oldbasepath,oldfusepath,oldfullpath);
|
||||
|
||||
rv = ::rename(oldfullpath.c_str(),newfullpath.c_str());
|
||||
error = _process_rv(rv,error,errno);
|
||||
error = calc_error(rv,error,errno);
|
||||
if(rv == -1)
|
||||
tounlink.push_back(oldfullpath);
|
||||
}
|
||||
|
|
@ -231,7 +215,7 @@ _rename_preserve_path_one(Policy::Func::Search searchFunc,
|
|||
rv = ::rename(oldfullpath.c_str(),newfullpath.c_str());
|
||||
}
|
||||
|
||||
error = _process_rv(rv,error,errno);
|
||||
error = calc_error(rv,error,errno);
|
||||
if(rv == -1)
|
||||
toremove.push_back(oldfullpath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue