Expose base parameter in s3fs_strtoofft

This fixes a regression from ccf3e7bfa2
which caused the misparsing of octal inputs for the mp_umask and umask
flags.  It also allows some callers to be more precise about their
decimal inputs.
This commit is contained in:
Andrew Gaul
2019-09-04 20:36:42 -07:00
parent ae4bcd405c
commit 412876ca33
5 changed files with 13 additions and 13 deletions

View File

@ -53,11 +53,11 @@ template std::string str(unsigned long long value);
static const char hexAlphabet[] = "0123456789ABCDEF";
// replacement for C++11 std::stoll
off_t s3fs_strtoofft(const char* str, bool is_base_16)
off_t s3fs_strtoofft(const char* str, int base)
{
errno = 0;
char *temp;
long long result = strtoll(str, &temp, is_base_16 ? 16 : 10);
long long result = strtoll(str, &temp, base);
if(temp == str || *temp != '\0'){
throw std::invalid_argument("s3fs_strtoofft");