mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-12 02:23:45 +00:00
Reject invalid policies
This commit is contained in:
committed by
trapexit
parent
9308a3729c
commit
997b036064
+15
-6
@@ -22,10 +22,13 @@
|
||||
int
|
||||
Func::Base::Action::from_string(const std::string_view policyname_)
|
||||
{
|
||||
policy = Policies::Action::find(policyname_);
|
||||
if(!policy)
|
||||
auto *tmp = Policies::Action::find(policyname_);
|
||||
|
||||
if(not tmp)
|
||||
return -EINVAL;
|
||||
|
||||
policy = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,10 +41,13 @@ Func::Base::Action::to_string(void) const
|
||||
int
|
||||
Func::Base::Create::from_string(const std::string_view policyname_)
|
||||
{
|
||||
policy = Policies::Create::find(policyname_);
|
||||
if(!policy)
|
||||
auto *tmp = Policies::Create::find(policyname_);
|
||||
|
||||
if(not tmp)
|
||||
return -EINVAL;
|
||||
|
||||
policy = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -54,10 +60,13 @@ Func::Base::Create::to_string(void) const
|
||||
int
|
||||
Func::Base::Search::from_string(const std::string_view policyname_)
|
||||
{
|
||||
policy = Policies::Search::find(policyname_);
|
||||
if(!policy)
|
||||
auto *tmp = Policies::Search::find(policyname_);
|
||||
|
||||
if(not tmp)
|
||||
return -EINVAL;
|
||||
|
||||
policy = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user