mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 02:48:59 -04:00
Reject invalid policies
This commit is contained in:
parent
9308a3729c
commit
997b036064
1 changed files with 15 additions and 6 deletions
21
src/func.cpp
21
src/func.cpp
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue