mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 10:51:52 -04:00
Better error handling in pagesize config type
This commit is contained in:
parent
7ee2d65cad
commit
c248dddef2
1 changed files with 8 additions and 1 deletions
|
|
@ -46,12 +46,19 @@ ConfigPageSize::to_string(void) const
|
|||
int
|
||||
ConfigPageSize::from_string(const std::string_view s_)
|
||||
{
|
||||
int rv;
|
||||
u64 v;
|
||||
u64 pagesize;
|
||||
|
||||
if(s_.empty())
|
||||
return -EINVAL;
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
|
||||
str::from(s_,&v);
|
||||
rv = str::from(s_,&v);
|
||||
if(rv < 0)
|
||||
return rv;
|
||||
|
||||
if(!std::isalpha(s_.back()))
|
||||
v *= pagesize;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue