Merge pull request #70 from s3fs-fuse/master

Fixed for #68(FreeBSD issue)
This commit is contained in:
Takeshi Nakatani 2014-10-21 23:56:41 +09:00
commit 2724728476
2 changed files with 7 additions and 3 deletions

View File

@ -3165,7 +3165,7 @@ static int read_passwd_file(void)
size_t first_pos = string::npos; size_t first_pos = string::npos;
size_t last_pos = string::npos; size_t last_pos = string::npos;
bool default_found = 0; bool default_found = 0;
bool aws_format; int aws_format;
// if you got here, the password file // if you got here, the password file
// exists and is readable by the // exists and is readable by the

View File

@ -486,11 +486,13 @@ string get_username(uid_t uid)
// make buffer // make buffer
if(0 == maxlen){ if(0 == maxlen){
if(0 > (maxlen = (size_t)sysconf(_SC_GETPW_R_SIZE_MAX))){ long res = sysconf(_SC_GETPW_R_SIZE_MAX);
if(0 > res){
DPRNNN("could not get max pw length."); DPRNNN("could not get max pw length.");
maxlen = 0; maxlen = 0;
return string(""); return string("");
} }
maxlen = res;
} }
if(NULL == (pbuf = (char*)malloc(sizeof(char) * maxlen))){ if(NULL == (pbuf = (char*)malloc(sizeof(char) * maxlen))){
DPRNCRIT("failed to allocate memory."); DPRNCRIT("failed to allocate memory.");
@ -522,11 +524,13 @@ int is_uid_inculde_group(uid_t uid, gid_t gid)
// make buffer // make buffer
if(0 == maxlen){ if(0 == maxlen){
if(0 > (maxlen = (size_t)sysconf(_SC_GETGR_R_SIZE_MAX))){ long res = sysconf(_SC_GETGR_R_SIZE_MAX);
if(0 > res){
DPRNNN("could not get max name length."); DPRNNN("could not get max name length.");
maxlen = 0; maxlen = 0;
return -ERANGE; return -ERANGE;
} }
maxlen = res;
} }
if(NULL == (pbuf = (char*)malloc(sizeof(char) * maxlen))){ if(NULL == (pbuf = (char*)malloc(sizeof(char) * maxlen))){
DPRNCRIT("failed to allocate memory."); DPRNCRIT("failed to allocate memory.");