From 50137fe026bd064801347158ed9968391f8c6eb6 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Thu, 16 Oct 2014 23:32:41 -0700 Subject: [PATCH] Address clang always true warnings --- src/s3fs.cpp | 2 +- src/s3fs_util.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index f624401..f16ba14 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -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 diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index 63eff7a..88a9436 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -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.");