mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-15 08:54:07 +00:00
Set errno to zero before calling sysconf (#2515)
FreeBSD returns -1 since it has no limits for _SC_GETPW_R_SIZE_MAX and _SC_GETGR_R_SIZE_MAX but is not required to reset errno. Also fix up logging. Fixes #2514.
This commit is contained in:
parent
7d2d4e8866
commit
22869d99a5
@ -66,20 +66,22 @@ void init_sysconf_vars()
|
||||
// there is no hard limit on the size of the buffer needed to
|
||||
// store all the groups returned.
|
||||
|
||||
errno = 0;
|
||||
long res = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||
if(0 > res){
|
||||
if (errno != 0){
|
||||
S3FS_PRN_WARN("could not get max pw length.");
|
||||
S3FS_PRN_ERR("could not get max password length.");
|
||||
abort();
|
||||
}
|
||||
res = 1024; // default initial length
|
||||
}
|
||||
max_password_size = res;
|
||||
|
||||
errno = 0;
|
||||
res = sysconf(_SC_GETGR_R_SIZE_MAX);
|
||||
if(0 > res) {
|
||||
if (errno != 0) {
|
||||
S3FS_PRN_ERR("could not get max name length.");
|
||||
S3FS_PRN_ERR("could not get max group name length.");
|
||||
abort();
|
||||
}
|
||||
res = 1024; // default initial length
|
||||
|
Loading…
Reference in New Issue
Block a user