fixes
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
2024-10-24 19:01:33 -05:00
parent 8692541e7f
commit 57b007759e
6 changed files with 21 additions and 18 deletions

View File

@ -64,7 +64,7 @@ namespace {
home = repertory::utils::path::combine("/home", {pw->pw_name});
}
});
if (res) {
if (not res) {
throw repertory::utils::error::create_exception(function_name,
{
"failed to getpwuid",

View File

@ -19,11 +19,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <utils/config.hpp>
#if !defined(_WIN32)
#include "utils/collection.hpp"
#include "utils/unix.hpp"
#include "utils/collection.hpp"
namespace repertory::utils {
#if !defined(__APPLE__)
@ -38,7 +37,7 @@ auto get_thread_id() -> std::uint64_t {
return convert_to_uint64(pthread_self());
}
auto is_uid_member_of_group(const uid_t &uid, const gid_t &gid) -> bool {
auto is_uid_member_of_group(uid_t uid, gid_t gid) -> bool {
std::vector<gid_t> groups{};
auto res = use_getpwuid(uid, [&groups](struct passwd *pass) {
int group_count{};
@ -53,7 +52,7 @@ auto is_uid_member_of_group(const uid_t &uid, const gid_t &gid) -> bool {
}
});
if (not res.ok) {
if (not res) {
throw utils::error::create_exception(res.function_name,
{"use_getpwuid failed", res.reason});
}
@ -69,11 +68,15 @@ auto use_getpwuid(uid_t uid, passwd_callback_t callback) -> result {
auto *temp_pw = getpwuid(uid);
if (temp_pw == nullptr) {
return {function_name, false, "'getpwuid' returned nullptr"};
return {
std::string{function_name},
false,
"'getpwuid' returned nullptr",
};
}
callback(temp_pw);
return {function_name};
return {std::string{function_name}};
}
} // namespace repertory::utils