diff --git a/man/mergerfs.1 b/man/mergerfs.1 index 6325f8c5..e57396bf 100644 --- a/man/mergerfs.1 +++ b/man/mergerfs.1 @@ -704,8 +704,8 @@ Even though it\[cq]s a more niche situation this hack breaks normal security and behavior and as such is \f[C]off\f[R] by default. If set to \f[C]git\f[R] it will only perform the hack when the path in question includes \f[C]/.git/\f[R]. -\f[C]all\f[R] will result it applying anytime a readonly file which -is empty is opened for writing. +\f[C]all\f[R] will result it applying anytime a readonly file which is +empty is opened for writing. .SH FUNCTIONS, CATEGORIES and POLICIES .PP The POSIX filesystem API is made up of a number of functions. @@ -1643,7 +1643,7 @@ Fast network, slow drives, small\[cq]ish bursty writes: You have a 10+Gbps network and wish to transfer amounts of data less than your cache drive but wish to do so quickly. .PP -With #1 it's arguable if you should be using mergerfs at all. +With #1 it\[cq]s arguable if you should be using mergerfs at all. RAID would probably be the better solution. If you\[cq]re going to use mergerfs there are other tactics that may help: spreading the data across drives (see the mergerfs.dup tool) and @@ -1963,7 +1963,7 @@ efficiently determine whether to scan for new content rather than simply performing a full scan. If using the default \f[B]getattr\f[R] policy of \f[B]ff\f[R] it\[cq]s possible those programs will miss an update on account of it returning -the first directory found\[cq]s \f[B]stat\f[R] info and its a later +the first directory found\[cq]s \f[B]stat\f[R] info and it\[cq]s a later directory on another mount which had the \f[B]mtime\f[R] recently updated. To fix this you will want to set \f[B]func.getattr=newest\f[R]. diff --git a/src/category.cpp b/src/category.cpp index e1fd7f2a..cc3e52ff 100644 --- a/src/category.cpp +++ b/src/category.cpp @@ -42,7 +42,7 @@ Category::Base::to_string(void) const { std::set rv; - for(auto func : funcs) + for(const auto func : funcs) rv.insert(func->to_string()); return str::join(rv,','); diff --git a/src/func.cpp b/src/func.cpp index 39aa7194..1c6065c6 100644 --- a/src/func.cpp +++ b/src/func.cpp @@ -23,6 +23,8 @@ int Func::Base::Action::from_string(const std::string &policyname_) { policy = Policies::Action::find(policyname_); + if(!policy) + return -EINVAL; return 0; } @@ -37,6 +39,8 @@ int Func::Base::Create::from_string(const std::string &policyname_) { policy = Policies::Create::find(policyname_); + if(!policy) + return -EINVAL; return 0; } @@ -51,6 +55,8 @@ int Func::Base::Search::from_string(const std::string &policyname_) { policy = Policies::Search::find(policyname_); + if(!policy) + return -EINVAL; return 0; } diff --git a/src/mergerfs.cpp b/src/mergerfs.cpp index 56a52e8e..24a76eaa 100644 --- a/src/mergerfs.cpp +++ b/src/mergerfs.cpp @@ -164,7 +164,10 @@ namespace l options::parse(&args,&errs); if(errs.size()) - std::cerr << errs << std::endl; + { + std::cerr << errs << std::endl; + return 1; + } l::setup_resources(); l::get_fuse_operations(ops,cfg->nullrw); diff --git a/src/policy.hpp b/src/policy.hpp index e527b94a..de7a4bfb 100644 --- a/src/policy.hpp +++ b/src/policy.hpp @@ -73,6 +73,11 @@ namespace Policy return (*impl)(branches_,fusepath_.c_str(),paths_); } + operator bool() const + { + return (bool)impl; + } + private: ActionImpl *impl; }; @@ -134,6 +139,11 @@ namespace Policy return (*impl)(branches_,fusepath_.c_str(),paths_); } + operator bool() const + { + return (bool)impl; + } + private: CreateImpl *impl; }; @@ -188,6 +198,11 @@ namespace Policy return (*impl)(branches_,fusepath_.c_str(),paths_); } + operator bool() const + { + return (bool)impl; + } + private: SearchImpl *impl; };