mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-25 18:40:18 -04:00
Improve error handling when querying pagesize
This commit is contained in:
parent
9bfe9af9bf
commit
a55f1f5c7d
1 changed files with 11 additions and 1 deletions
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "from_string.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
|
|
@ -48,12 +50,20 @@ ConfigPageSize::from_string(const std::string_view s_)
|
|||
{
|
||||
int rv;
|
||||
u64 v;
|
||||
long tmp;
|
||||
u64 pagesize;
|
||||
|
||||
if(s_.empty())
|
||||
return -EINVAL;
|
||||
|
||||
pagesize = sysconf(_SC_PAGESIZE);
|
||||
tmp = sysconf(_SC_PAGESIZE);
|
||||
if(tmp <= 0)
|
||||
{
|
||||
perror("mergerfs: pagesize query failed");
|
||||
std::abort();
|
||||
}
|
||||
|
||||
pagesize = (u64)tmp;
|
||||
|
||||
rv = str::from(s_,&v);
|
||||
if(rv < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue