Address clang always true warnings

This commit is contained in:
Andrew Gaul 2014-10-16 23:32:41 -07:00
parent 9237d07226
commit 50137fe026
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 last_pos = string::npos;
bool default_found = 0;
bool aws_format;
int aws_format;
// if you got here, the password file
// exists and is readable by the

View File

@ -486,11 +486,13 @@ string get_username(uid_t uid)
// make buffer
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.");
maxlen = 0;
return string("");
}
maxlen = res;
}
if(NULL == (pbuf = (char*)malloc(sizeof(char) * maxlen))){
DPRNCRIT("failed to allocate memory.");
@ -522,11 +524,13 @@ int is_uid_inculde_group(uid_t uid, gid_t gid)
// make buffer
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.");
maxlen = 0;
return -ERANGE;
}
maxlen = res;
}
if(NULL == (pbuf = (char*)malloc(sizeof(char) * maxlen))){
DPRNCRIT("failed to allocate memory.");