mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-19 16:16:48 +00:00
Improve error handling when querying pagesize
This commit is contained in:
committed by
trapexit
parent
164b7f73c9
commit
e0a892f0d0
+11
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user